Re: TimeZone

Andrew Lindesay <[email protected]> Mon, 31 Oct 2011 08:28:25 +1300
Newsgroups gmane.comp.web.webobjects.woproject.devel
Message-ID <[email protected]>
Hello Peter;

(making a few assumptions...)

My advice would be to store all date-time data in the database relative 
to GMT0 and to use a sub-class of SimpleDateFormat which yields 
NSTimestamps.  Use this format to render or parse date-time data using 
the "formatter" binding on WOTextField or WOString.  Assuming 
session-workflow; store the instance of the format on your WOSession 
sub-class and access it through the components.  You will note that 
SimpleDateFormat has a "setTimeZone(..)" on it.  Use this method to 
configure the time-zone for parse and render and store the time-zone on 
the user in the database.

You then need to do date arithmetic in the application server relative 
to GMT0, but if you have to handle multiple time-zones IMHO it quickly 
becomes apparent this is the most sensible thing to do.

Regards.

On 31/10/11 1:34 AM, "Peter Müller" wrote:
> Hello WO-Experts,
> is it possible to tell the WebObjects-Application, that it should work with a another TimeZone than the Server self has? For example: Server is located in Germany, but the application is for a project in USA.
>
> I found out, that if i set the Timezone of Date-Fields in the model to this Timezone, it works for those fields. But i need this also for other things, so e.g. aDate = new NSTimestamp(); should also be the USA-Time and not the time of the Server.
>
> Thank you :)
> Peter M.


-- 
Andrew Lindesay
www.silvereye.co.nz