File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes fmt:parseDate with SQL Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "fmt:parseDate with SQL Date" Watch "fmt:parseDate with SQL Date" New topic
Author

fmt:parseDate with SQL Date

Craig Dixon
Greenhorn

Joined: Jul 19, 2005
Posts: 19
I'm pulling a date out of a SQL Server database to display on a JSP, but the format isn't terribly user friendly. It looks like the following: 2006-07-19 00:00:00.0. I'd like it to look more like: July 19, 2006. I think <fmt:parseDate> will do the job, but I'm a little unclear on its use. I thought the following was what I needed:


This doesn't work, however. I also looked at <fmt:formatDate>, but it looks as though that only works with the java.util.Date data type. Can someone give me some direction?
[ March 15, 2006: Message edited by: Craig Dixon ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60975
    
  65

Originally posted by Craig Dixon:
I'm pulling a date out of a SQL Server database to display on a JSP, but the format isn't terribly user friendly.


Dates don't have inherent formats. What you are seeing is the result of a simple toString() conversion.

I think <fmt:parseDate> will do the job


<fmt:parseDate> is used to convert strings to dates. So, no.

What you need is <fmt:formatDate>.

but it looks as though that only works with the java.util.Date data type.


A java.sql.Date is a java.util.Date.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Craig Dixon
Greenhorn

Joined: Jul 19, 2005
Posts: 19
Thanks a bunch. Not sure why I had so much trouble with that.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60975
    
  65

Sometimes it just takes someone to nudge ya...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: fmt:parseDate with SQL Date