my dog learned polymorphism*
The moose likes Java in General and the fly likes how can i reformat a Date object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how can i reformat a Date object" Watch "how can i reformat a Date object" New topic
Author

how can i reformat a Date object

netanel weinberg
Greenhorn

Joined: May 10, 2004
Posts: 27
hello,
i have a date object with date details and i want to reformat it from yyyyy-MM-dd format to dd/MM/yyyy format how can i do it?

10x ahead,
netanel
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Intermediate forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Ankur Srivastava
Ranch Hand

Joined: May 11, 2004
Posts: 62
You should use java.text.SimpleDateFormat class for your purpose.
Jack Kay
Ranch Hand

Joined: Aug 01, 2004
Posts: 62
Alright, import Date & DateFormat:


Now you'll create a Date & DateFormat object:


Now you'll format the Date with the DateFormatter:


The closest I could get you was to dd/MM/yy

I'll research around to find the answer!
[ August 01, 2004: Message edited by: Jack Kay ]
Jack Kay
Ranch Hand

Joined: Aug 01, 2004
Posts: 62
Ankur Srivastava was right.

[ August 01, 2004: Message edited by: Jack Kay ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can i reformat a Date object