You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mi...@ubsw.com on 2003/05/09 08:54:48 UTC

RE: current best practices for time zones ADD [OT]

While we are on the timezone issue, I am wondering if there is a standard way to gt a list of available timezones world-wide?


-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com]
Sent: Thursday, May 08, 2003 10:20 PM
To: Struts Users Mailing List
Subject: Re: current best practices for time zones


Assuming you can create a scoped attribute of type String or java.util.TimeZone
called "timeZone", try JSTL:

<fmt:formatDate value="${date}"
                pattern="hh:mm:ssa/yyyy.MM.dd"
                timeZone="${timeZone}"/>

Quoting Kirby Vandivort <kv...@ks.uiuc.edu>:

> Let's say I want to print the current time (or choose your favorite 
> time) from the server to the user's browser.
> 
> Currently, I'm storing a Date object in appropriate scope, and when
> I get to the front end, I'm doing something similar to:
> 
> <bean:write name="theTime" property="dateObj"
> formatKey="format.time.date"/>
> 
> where format.time.date is something like hh:mm:ssa'/'yyyy.MM.dd as an
> example.
> 
> 
> So, that's the background.  I was (naively, I suppose) expecting that
> struts would figure out where the user is coming from, similar to how
> it does language determination, and automatically convert the Date from
> the server's timezone to the user's browser's timezone.
> 
> However, this is not happening.  All dates are getting printed in the
> server's timezone.
> 
> Is there a relatively clean way to handle this?  Searching the archive
> returns a few hits from 2001 and I was wondering if there is anything
> new on this.  Am I going to have to end up creating Locales on the
> business end and managing everything there, or can I handle this
> presentation-side?
> 
> Just curious what others that are a bit closer to the pulse of recent
> struts than I have chosen.
> 
> TIA,
> 
> -- 
> 
> Kirby Vandivort                      Theoretical and Computational Biophysics
> 
> Email: kvandivo@ks.uiuc.edu          3051 Beckman Institute
> http://www.ks.uiuc.edu/~kvandivo/    University of Illinois
> Phone: (217) 244-5711                405 N. Mathews Ave
> Fax  : (217) 244-6078                Urbana, IL  61801, USA
> 
> ---------------------------------------------------------------------
> 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


Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.


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


RE: current best practices for time zones ADD [OT]

Posted by Andrew Hill <an...@gridnode.com>.
The static method TimeZone.getAvailableIDs() will give you a String[] of all
the timezones (or to be more precise their IDs) preset in the JVM. Of course
this list differs with each JVM version - and probably isnt a definitive
list of all the worlds timezones - its also got a lot of redundant
timezones - the same zone with different names or ids, and a fair few
deprecated ones too. Have a good read of the javadocs for the TimeZone
class.
Bit of a dogs breakfast really. :-(
(Not as bad as Calendar and Date though!)

-----Original Message-----
From: Mick.Knutson@ubsw.com [mailto:Mick.Knutson@ubsw.com]
Sent: Friday, 9 May 2003 14:55
To: struts-user@jakarta.apache.org
Subject: RE: current best practices for time zones ADD [OT]


While we are on the timezone issue, I am wondering if there is a standard
way to gt a list of available timezones world-wide?


-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com]
Sent: Thursday, May 08, 2003 10:20 PM
To: Struts Users Mailing List
Subject: Re: current best practices for time zones


Assuming you can create a scoped attribute of type String or
java.util.TimeZone
called "timeZone", try JSTL:

<fmt:formatDate value="${date}"
                pattern="hh:mm:ssa/yyyy.MM.dd"
                timeZone="${timeZone}"/>

Quoting Kirby Vandivort <kv...@ks.uiuc.edu>:

> Let's say I want to print the current time (or choose your favorite
> time) from the server to the user's browser.
>
> Currently, I'm storing a Date object in appropriate scope, and when
> I get to the front end, I'm doing something similar to:
>
> <bean:write name="theTime" property="dateObj"
> formatKey="format.time.date"/>
>
> where format.time.date is something like hh:mm:ssa'/'yyyy.MM.dd as an
> example.
>
>
> So, that's the background.  I was (naively, I suppose) expecting that
> struts would figure out where the user is coming from, similar to how
> it does language determination, and automatically convert the Date from
> the server's timezone to the user's browser's timezone.
>
> However, this is not happening.  All dates are getting printed in the
> server's timezone.
>
> Is there a relatively clean way to handle this?  Searching the archive
> returns a few hits from 2001 and I was wondering if there is anything
> new on this.  Am I going to have to end up creating Locales on the
> business end and managing everything there, or can I handle this
> presentation-side?
>
> Just curious what others that are a bit closer to the pulse of recent
> struts than I have chosen.
>
> TIA,
>
> --
>
> Kirby Vandivort                      Theoretical and Computational
Biophysics
>
> Email: kvandivo@ks.uiuc.edu          3051 Beckman Institute
> http://www.ks.uiuc.edu/~kvandivo/    University of Illinois
> Phone: (217) 244-5711                405 N. Mathews Ave
> Fax  : (217) 244-6078                Urbana, IL  61801, USA
>
> ---------------------------------------------------------------------
> 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


Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


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


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