You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Tony Grant <to...@tgds.net> on 2003/09/02 18:15:22 UTC

fmt:formatDate problems jstl 1.0.3

Hello,

I am trying to format dates that are the result of a database query. The
dates are stocked in the database (PostgreSQL) as "date" data type.

They are returned to the jsp in the format 2003-11-09 the JSP code is
generated by Dreamweaver MX 
<%=(((oeuvre_data = oeuvre.getObject("dateexpofin"))==null ||
oeuvre.wasNull())?"":oeuvre_data)%> 

I wish to have the date in the French locale.

<fmt:setLocale value="fr_FR"/> is set on the page and fmt:formatNumber
works perfectly.

I am using JSTL in Action JSTL reference as my source of information.

Where to go from here???

TIA

Tony Grant
-- 
www.tgds.net Library management software toolkit, 
redhat linux on Sony Vaio C1XD, 
Dreamweaver MX with Tomcat and PostgreSQL


Re: fmt:formatDate problems jstl 1.0.3

Posted by Felipe Leme <t5...@sneakemail.com>.
On Wednesday 03 September 2003 06:14 am, Tony Grant tony-at-tgds.net |jakarta| 
wrote:
> Now I have located the root of my problem. My query is returning a
> string and not a date...

If the query is returning a string, you could convert it to a date first -  
using parseNumber - and then format it in the proper locale:

<%  String sDate  = oeuvre_data; // simplified expression %>
<fmt:parseNumber var="date" parseLocale="en_US"><%=sDate%></fmt:parseNumber>
<fmt:formatNumber value="${date}"/>

If the locale is not en_US you can replace it or even use the pattern 
attribute.

Felipe


Re: fmt:formatDate problems jstl 1.0.3

Posted by Tony Grant <to...@tgds.net>.
On Tue, 2003-09-02 at 23:19, Felipe Leme wrote:

> I'm not sure if I understood the problem correctly, but it looks like you are 
> not calling the fmt:formatNumber tag. Try something like this:
> 
> <%  Date date  =(((oeuvre_data = oeuvre.getObject("dateexpofin"))==null ||
> > oeuvre.wasNull())?"":oeuvre_data);
> %>
> 
> <fmt-rt:formatNumber value="<%=date%>"/>

Thanks for that!

Now I have located the root of my problem. My query is returning a
string and not a date...

Tony Grant
-- 
www.tgds.net Library management software toolkit, 
redhat linux on Sony Vaio C1XD, 
Dreamweaver MX with Tomcat and PostgreSQL


Re: fmt:formatDate problems jstl 1.0.3

Posted by Felipe Leme <t5...@sneakemail.com>.
On Tuesday 02 September 2003 01:15 pm, Tony Grant tony-at-tgds.net |jakarta| 
wrote:
> They are returned to the jsp in the format 2003-11-09 the JSP code is
> generated by Dreamweaver MX
> <%=(((oeuvre_data = oeuvre.getObject("dateexpofin"))==null ||
> oeuvre.wasNull())?"":oeuvre_data)%>