First you need to parse the date returned from sql, then format it.

Something like this might work:

<dt:format pattern="MM-dd-yyyy">
  <dt:parse pattern="yyyy-MM-dd"><%=rs.getString("effective_date")%></dt:parse>
</dt:format>

Also the case of the format characters makes a difference.  In this case
you need a capital M to get the month number.

The formatting rules can be found here:

http://jakarta.apache.org/taglibs/doc/datetime-doc/index.html#pattern

Regards,

Glenn

Jeff Self wrote:
I've got a JSP page that is retrieving information from a PostgreSQL
database. One of the fields is a datefield. Here's the code to what I'm
displaying:

while (rs.next()) {
%>
<tr>
  <td><%= rs.getString("position_code") %></td>
  <td><%= rs.getString("effective_date") %></td>
</tr>

When it displays, the date shows up in the following format: 2002-11-14

I'd like it to show up as '11-14-2002'. I'm trying to use the datetime
taglib so I tried it like this:

  <td><dt:format pattern="mm/dd/yyyy"><%=rs.getString("effective_date")
%></dt:format></td>

But when I run the JSP now, It says invalid date instead of showing the
date.

What am I doing wrong?

		

--
----------------------------------------------------------------------
Glenn Nielsen             [EMAIL PROTECTED] | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to