• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Date Formatting

 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic