• 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: Daylight Savings Time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Daylight Savings Time


  • Subject: Re: Daylight Savings Time
  • From: Peter Duniho <email@hidden>
  • Date: Wed, 15 Apr 2009 12:47:39 -0700

On Apr 15, 2009, at 11:53 AM, Greg Robertson wrote:

I have put together some code from various sites such as this one:
http://blog.coriolis.ch/2009/02/20/relative-date-to-now/

Basically I would like to display records for a week duration but I am
unsure how to handle daylight savings time. Is there a way to see if
daylight savings time has or will occur?

The logic of my code is to display from Sunday to Saturday zeroing out
the current time to midnight but it does not appear to work well with
daylight savings which then sees one day overlapping another.

Anyone see or know of any code to deal with daylight savings time?

I don't have specific code examples. But, generally:

-- use something like NSTimeZone's "isDaylightSavingTime" or "isDaylightSavingTimeForDate" to know whether a specific date/time is in fact a daylight saving time

-- Convert your date/time information to UTC for actual processing, using the DST information as appropriate; depending on where the data comes from this may or may not result in ambiguity during the Fall transition...you may have to ask the user whether the local time is before or after the transition time, or just accept the overlap in the results. But, if you can get the input to include the exact time zone (e.g. "PST" versus "PDT") and/or the raw UTC offset, this isn't an issue.

-- don't forget to use the correct term: "daylight saving time", no plural. :)

Pete
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Daylight Savings Time (From: Greg Robertson <email@hidden>)

  • Prev by Date: Re: Networking
  • Next by Date: How to test if object is KVO observer?
  • Previous by thread: Daylight Savings Time
  • Next by thread: Re: Daylight Savings Time
  • Index(es):
    • Date
    • Thread