This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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.
It is sorta covered in the JavaRanch Style Guide.
subject: Column type
It's not a secret anymore!