It's not a secret anymore!
The moose likes Beginning Java and the fly likes Column type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Column type" Watch "Column type" New topic

Column type

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Hi friends,
I have a date column and it's type is Date. Do I need to have "SimpleDateFormat" in my program to format my date as well or not?

Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
That really depends on what you want to do with that Date object. The Date class has a toString() method which displays the date it contains, but you can't modify how this date if formatted using only the Date class. If you want to format it to a specific user's taste or to some general format of your own, you'll have to use the SimpleDateFormat class. However, if you don't need to display it in any special way, you won't need that class.

SCJP Tipline, etc.
I agree. Here's the link:
subject: Column type
It's not a secret anymore!