Re: NSDate/NSDateFormatter question
Re: NSDate/NSDateFormatter question
- Subject: Re: NSDate/NSDateFormatter question
- From: John Brownie <email@hidden>
- Date: Sun, 25 Mar 2012 14:40:24 +1100
Donald Hall wrote:
2012-03-24 20:57:18.976 calendardatetest[77052:707] now is 2012-03-25 02:57:18 +0000
2012-03-24 20:57:18.977 calendardatetest[77052:707] stringFromDate=8:57 PM
2012-03-24 20:57:18.978 calendardatetest[77052:707] new date from string=1970-01-02 03:57:00 +0000
2012-03-24 20:57:18.979 calendardatetest[77052:707] 2nd stringFromDate=8:57 PM
"now" is what I expected as the test was done at 8:57 PM local time, which being MDT is 6 hours behind GMT
When I go in reverse using just the time string, the time for the new date object seems to ignore Daylight Saving Time - it gives 3:57 on the next day instead of 2:57.However, if I create a new date string from this I get the correct local time again, with DST taken into account. (I don't care about the y-m-d part of the date object in my application.)
It seems to give back the correct local time even though the GMT time differs by one hour in the two cases and the date formatter is the same.
I'm no expert on this, but the change of date by feeding just a time
means that you are looking at January 1970, which would never have DST
applied in the northern hemisphere. Is that part of your problem?
John
--
John Brownie, email@hidden or email@hidden
On furlough in Australia from:
Summer Institute of Linguistics | Mussau-Emira language, Mussau Is.
Ukarumpa, Eastern Highlands Province | New Ireland Province
Papua New Guinea | Papua New Guinea
_______________________________________________
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