aspose file tools*
The moose likes JDBC and the fly likes Date Formatting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Date Formatting" Watch "Date Formatting" New topic
Author

Date Formatting

vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
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
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

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

Joined: Feb 17, 2005
Posts: 279
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date Formatting