aspose file tools*
The moose likes Java in General and the fly likes how to convert date to a 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 convert date to a string" Watch "how to convert date to a string" New topic
Author

how to convert date to a string

Chitti pokala
Ranch Hand

Joined: Jan 11, 2005
Posts: 46
Hi
I am using a date fucntion in jsp. I want to convert 2005-01-31 to 31-Jan-2005.

How can I convert this......

Thanks in Advance.
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Have a look at DateFormat and SimpleDateFormat classes in java.text package.

Here's an example -



HTH.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61653
    
  67

Not much to do with JSP, so moved to Java in General (intermediate).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
friso dejonge
Ranch Hand

Joined: Jul 11, 2002
Posts: 162
Hi,

There is a simple answer like the one below. But maybe it is more challenging to read the java tutorial:

http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html

regards,
friso


swimming certificate (A & B), shoelaces diploma, and some useless java ones.
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Calculating Java dates: Take the time to learn how to create and use dates
Working in Java time: Learn the basics of calculating elapsed time in Java

Formatting a Date Using a Custom Format
Parsing a Date Using a Custom Format
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to convert date to a string