Re: Date-Only NSTimestamps
Re: Date-Only NSTimestamps
- Subject: Re: Date-Only NSTimestamps
- From: Chuck Hill <email@hidden>
- Date: Wed, 2 Jan 2008 13:18:51 -0800
On Jan 2, 2008, at 1:08 PM, Simon McLean wrote:
So, what are the best practices for working with an NSTimestamp
field, when all you really want is the date, not the time?
There isn't any that I am aware of. I usually "normalize" these
to noon in the setXXXDate() methods.
You can get some funny results normalising stuff if your server is
in a timezone that uses daylight saving and your report time frame
crosses the point at which the timezone switches. eg. normalising
to 12 noon mid winter in the UK gives you 12:00 GMT, but in the
summer it gives you 11:00 GMT. I can't remember exactly where it
goes wrong, i just remember being bitten by it on more than one
occasion...
Now that you mention it... I think we normalize to noon to avoid the
date shifting across DST changes and then use startOfDay and endOfDay
for querying. Dates are a nasty mess. Hate them!
It should be possible to normalize it at 12:00 GMT instead of the
default time zone. I need to try that out.
Java and dates. Shudder. Twitch.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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