You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <r...@reumann.net> on 2003/06/25 15:54:37 UTC

Re: way to format a date property inside an iterate loop?

On Wed, 2003-06-25 at 09:47, Nielsen, Jim wrote:
> Hi,
> 
> Is there a simple way to format a date property inside an iterate loop? The
> property is a long value. I want to have the display the date in a localize
> format.
> 
> Not having much luck searching for examples.

You could see if the JSTL fmt tag will format the long into the correct
date. I know it works great for formating Dates into nice String
representations. Not sure if it works for longs though. If it doesn't,
why not just store an extra field in your bean as a java.util.Date
(getLastModifiedAsDate( returns the getLastModifiedTime from long to
Date ).

Then just format that how you want.

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: way to format a date property inside an iterate loop?

Posted by Kris Schneider <kr...@dotech.com>.
With JSTL:

<jsp:useBean id="date" class="java.util.Date"/>

<%-- in loop --%>
<c:set target="${date}" property="time" value="${longValue}"/>
<fmt:formatDate value="${date}" .../>

Quoting Rick Reumann <r...@reumann.net>:

> On Wed, 2003-06-25 at 09:47, Nielsen, Jim wrote:
> > Hi,
> > 
> > Is there a simple way to format a date property inside an iterate loop?
> The
> > property is a long value. I want to have the display the date in a
> localize
> > format.
> > 
> > Not having much luck searching for examples.
> 
> You could see if the JSTL fmt tag will format the long into the correct
> date. I know it works great for formating Dates into nice String
> representations. Not sure if it works for longs though. If it doesn't,
> why not just store an extra field in your bean as a java.util.Date
> (getLastModifiedAsDate( returns the getLastModifiedTime from long to
> Date ).
> 
> Then just format that how you want.
> 
> -- 
> Rick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org