Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Converting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Converting "Mon Nov 24 00:00:00 EST 2008" pattern to "dd/MM/yyyy" pattern" Watch "Converting "Mon Nov 24 00:00:00 EST 2008" pattern to "dd/MM/yyyy" pattern" New topic
Author

Converting "Mon Nov 24 00:00:00 EST 2008" pattern to "dd/MM/yyyy" pattern

kasthala kasturi
Greenhorn

Joined: Dec 20, 2006
Posts: 3
Hi All,

In my application, there is a column in a database view called "date of birth" whose datatype is "date". I am retrieving the date of birth field from the database view on to the JSP screen but somehow, the date format "Mon Nov 24 00:00:00 EST 2008" is being displayed on JSP screen.

Please someone let me know how to convert this pattern "Mon Nov 24 00:00:00 EST 2008" to "dd/MM/yyyy" (24/11/2008) pattern?

Thanks in advance.

Kind Regards,
Shyam Kasthala
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You should have a look at the SimpleDateFormat class - which can take a java.util.Date and transform it to a String date defined with a pattern.


Regards, Rene Larsen
Dropbox Invite
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

You can also use the JSTL <fmt:formatDate> tag to format dates.

The "pattern" attribute takes a format string which shares the same rules as SimpleDateFormat.


SCJP 6 || SCWCD 5
kasthala kasturi
Greenhorn

Joined: Dec 20, 2006
Posts: 3
Thanks for your replies.

I will implement your suggestions and get back to you.

Kind Regards,
Shyam Kasthala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting "Mon Nov 24 00:00:00 EST 2008" pattern to "dd/MM/yyyy" pattern