• 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
Dates and time zones
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dates and time zones


  • Subject: Dates and time zones
  • From: Rory Prior <email@hidden>
  • Date: Fri, 10 Dec 2004 17:45:46 +0000

Hi all,

I've run into a slight problem dealing with natural language dates that include time zones in the format -0500, +0000 etc. Internally things seems to work fine - I can go [date description] and get back a string like "2004-11-29 15:30:00 -0500" which tells me NSDate has correctly parsed the natural language date and knows what the time zone is in its internal representation. However there is no way to get hold of that time zone information directly - you can't create an NSCalendarDate from an NSDate without supplying a time zone or using the system time zone which strikes me as being a bit retarded if the NSDate internally has a concept of what the time zone is.

My aim is translate dates into a 'friendly' form like this: "November 29, 3:30 pm EST".

I tried doing some string parsing to grab the ±0000 part of the date, which I could then convert into seconds and use to create an NSTimeZone - which would be great, but that will only give me GMT -0500 back again if I call it's name or abbreviation methods which is no better than what I started with. I'm amazed it doesn't seem to understand the relationship between an offset in hours from GMT and all the named time zones as you'd think this was essentially the job of this class. So do I need to reinvent the wheel here or am I missing something, perhaps in another class?

Cheers,

Rory
--

ThinkMac Software
http://www.thinkmac.co.uk
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Dates and time zones
      • From: Jonathan Jackel <email@hidden>
  • Prev by Date: Retain/release question
  • Next by Date: Re: [OT] Objective-C history
  • Previous by thread: Re: Retain/release question
  • Next by thread: Re: Dates and time zones
  • Index(es):
    • Date
    • Thread