Freemarker Timestamp rendering - Developers Take Note

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Freemarker Timestamp rendering - Developers Take Note

Adrian Crum
I just noticed in a Freemarker template file something like:

${someTimestamp.toString()}

There is a problem with that. Freemarker will call the Timestamp
object's toString() method - which will output the date and time in the
server's time zone and locale, NOT the user's.

It is better to eliminate the toString method call, like so:

${someTimestamp}

-Adrian
Reply | Threaded
Open this post in threaded view
|

Re: Freemarker Timestamp rendering - Developers Take Note

Ashish Vijaywargiya
+1.

On Wed, Jun 4, 2008 at 7:48 PM, Adrian Crum <[hidden email]> wrote:

> I just noticed in a Freemarker template file something like:
>
> ${someTimestamp.toString()}
>
> There is a problem with that. Freemarker will call the Timestamp object's
> toString() method - which will output the date and time in the server's time
> zone and locale, NOT the user's.
>
> It is better to eliminate the toString method call, like so:
>
> ${someTimestamp}
>
> -Adrian
>