• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Date-Only NSTimestamps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Date-Only NSTimestamps
      • From: Gavin Eadie <email@hidden>
    • Re: Date-Only NSTimestamps
      • From: Simon McLean <email@hidden>
References: 
 >Date-Only NSTimestamps (From: David Avendasora <email@hidden>)
 >Re: Date-Only NSTimestamps (From: Chuck Hill <email@hidden>)
 >Re: Date-Only NSTimestamps (From: Simon McLean <email@hidden>)

  • Prev by Date: Marketplace Survey results
  • Next by Date: Re: Date-Only NSTimestamps
  • Previous by thread: Re: Date-Only NSTimestamps
  • Next by thread: Re: Date-Only NSTimestamps
  • Index(es):
    • Date
    • Thread