• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date Formatting

 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting date from the resultset. So the default value will ne yyyy-MM-dd. but I need the date formatted into MM/dd/yyyy. SInce I need to assign the Date value in the return object that I need to display in the jsp. I need it as a Date because I need to sort the values according to the user input.

I tried doing this, but was not successful. I know, we can change to String to Date and vice-versa, but Date to format into another date, I was not able to do it.

Any help would be greatly appreciated.

Thanks.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just get the date from the ResultSet and don't format it into text just yet. Then, in the JSP, use the fmt:formatDate tag to display it in any format you like.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul.

Actually I am using display:table tag to display all the tables. So I cannot use fmt:formatDate tag there.

As of now I am displaying it in the yyyy-MM-dd format, and I am able to sort properly also. I will still work and try to figure out a way to use formatting in the display:table tag.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic