Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
kasthala kasturi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Angstadt
Ranch Hand
Posts: 277
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
kasthala kasturi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies.

I will implement your suggestions and get back to you.

Kind Regards,
Shyam Kasthala
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic