Re: Displaying Local Time on a Web Client
Re: Displaying Local Time on a Web Client
- Subject: Re: Displaying Local Time on a Web Client
- From: Mark Ritchie <email@hidden>
- Date: Tue, 31 Mar 2009 13:33:12 -0400
Hi David!
On 31-Mar-09, at 12:20 PM, David Avendasora wrote:
NSTimestamp timestamp = new NSTimestamp(calendar.getTimeInMillis(),
TimeZone.getTimeZone("America/Chicago"));
...
What fundamental thing am I missing or doing wrong?
The timeZone argument tells the constructor how to interpret the
milliseconds argument. NSTimestamp doesn't maintain timezone
information. Everything is converted to offset from reference date!
That way, two timestamps can be compared directly even if they are for
events from different parts of the world!
See the docs for more details!
http://developer.apple.com/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/foundation/NSTimestamp.html
To have the timestamp display properly for a particular user in their
current timezone (or their selected timezone if that's how your
application works) then you will need to set the timezone property of
the formatter which is turning the raw number into a nicely formatted
string! ;-) As Chuck has already pointed out, this needs to be done
by creating a formatter object and not using the dateformat binding.
Good luck!
Mark.
__
Mark Ritchie
Cocoa and WebObjects Developer
Diamond Lake Consulting Inc.
Toronto, Ontario, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden