Re: Recording and looking up dates, when day-wide precision is required
Re: Recording and looking up dates, when day-wide precision is required
- Subject: Re: Recording and looking up dates, when day-wide precision is required
- From: Lachlan Deck <email@hidden>
- Date: Wed, 24 Dec 2008 09:22:26 +1100
On 24/12/2008, at 9:08 AM, Lachlan Deck wrote:
On 24/12/2008, at 1:48 AM, Florijan Stamenkovic wrote:
One more thing... Reading the posts that David mentioned, I notice
there is some mentioning of java.util.Date being converted to and
from NSTimestamp. I am not sure why this is mentioned as a problem.
AFAIK, both Date and NSTimestamp (which inherits from Date) record
the amount of milliseconds that passed from January 1, 1970,
00:00:00 GMT. Conversion should be lossless, no? Or, is this a
problem for some other reason?
NSTimestamps understand timezones *only* during construction. From
that point on they are strictly UTC. i.e., they do not preserve the
timezone from which they were constructed. You'll need another
column, as mentioned above, to store that information.
To clarify, yes it is lossless insofar as date.getTime() ==
timestamp.getTime() where
Date date = new Date()
NSTimestamp timestamp = new NSTimestamp(date);
However, date.getTimeZoneOffset() != timestamp.getTimeZoneOffset()
unless date was in GMT/UTC.
with regards,
--
Lachlan Deck
_______________________________________________
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