File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes How to Reformat a date string 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 to Reformat a date string" Watch "How to Reformat a date string" New topic

How to Reformat a date string

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
I have a date string in the format 'yyyy-mm-dd' which I need to present
in a dialog as 'ddMMM'. Does anyone know how to accomplish this?

Max Habibi
town drunk
( and author)

Joined: Jun 27, 2002
Posts: 4118

I assume you meant ddmm as the reformat? Is so, try the following:


Java Regular Expressions
Greg T Robertson
Ranch Hand

Joined: Nov 18, 2003
Posts: 91
See the reference for Date Format and SimpleDateFormat

you will probably need to convert use DateFormat to get a timestamp first and then convert it to the text string you need using a differnt DateFormat object especially if you meant MMM (like May, Apr, Jun, etc)
[ October 22, 2004: Message edited by: Greg T Robertson ]
I agree. Here's the link:
subject: How to Reformat a date string
It's not a secret anymore!