You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by jie tang <cr...@gmail.com> on 2011/02/14 06:38:05 UTC

How to show the timestamp of listed file according to the user timezone?

I place a directory in Tomcat webapps directory. I want to Tomcat list files
under the directory.
When I browse the file list in my browser, the file list looks like the
following

   2011-02-12_r5384_1669/       Sat, 12 Feb 2011 09:40:44 GMT

But what I need is
   2011-02-12_r5384_1669/       Sat, 12 Feb 2011 17:40:44 GMT + 08

When I type the command "date",it shows
   Mon Feb 14 13:33:45 CST 2011
And I added the following statement to catalina.sh
   -Duser.timezone=GMT+08 \

So what should I do to get what I need?
Thanks.

Re: How to show the timestamp of listed file according to the user timezone?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jie tang,

On 2/14/2011 4:57 AM, Mark Thomas wrote:
> On 14/02/2011 05:38, jie tang wrote:
>> I place a directory in Tomcat webapps directory. I want to Tomcat list files
>> under the directory.
>> When I browse the file list in my browser, the file list looks like the
>> following
>>
>>    2011-02-12_r5384_1669/       Sat, 12 Feb 2011 09:40:44 GMT
>>
>> But what I need is
>>    2011-02-12_r5384_1669/       Sat, 12 Feb 2011 17:40:44 GMT + 08
>>
>> When I type the command "date",it shows
>>    Mon Feb 14 13:33:45 CST 2011
>> And I added the following statement to catalina.sh
>>    -Duser.timezone=GMT+08 \
>>
>> So what should I do to get what I need?
> 
> You'll need to modify/extend the DefaultServlet to check the user's
> Locale and determine the timezone from that.

Note that changing the display to show a date in a certain timezone is
trivial (just call DateFormat.setTimeZone, though that's a shared object
and will need to be un-shared to do this correctly) but determining
which time zone to use is non-trivial.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1atwoACgkQ9CaO5/Lv0PBxIwCghejr+Jsx1L9mCiQ99RWSFK8r
580An1XIQQsZyk/5Qo8IAZD2VaHwueVB
=5Sa6
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to show the timestamp of listed file according to the user timezone?

Posted by Mark Thomas <ma...@apache.org>.
On 14/02/2011 05:38, jie tang wrote:
> I place a directory in Tomcat webapps directory. I want to Tomcat list files
> under the directory.
> When I browse the file list in my browser, the file list looks like the
> following
> 
>    2011-02-12_r5384_1669/       Sat, 12 Feb 2011 09:40:44 GMT
> 
> But what I need is
>    2011-02-12_r5384_1669/       Sat, 12 Feb 2011 17:40:44 GMT + 08
> 
> When I type the command "date",it shows
>    Mon Feb 14 13:33:45 CST 2011
> And I added the following statement to catalina.sh
>    -Duser.timezone=GMT+08 \
> 
> So what should I do to get what I need?

You'll need to modify/extend the DefaultServlet to check the user's
Locale and determine the timezone from that.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org