File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fmt:parseDate with SQL Date

 
Craig Dixon
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Craig Dixon
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a bunch. Not sure why I had so much trouble with that.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes it just takes someone to nudge ya...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic