Re: NSDate's GMT offset changing with month change.
Re: NSDate's GMT offset changing with month change.
- Subject: Re: NSDate's GMT offset changing with month change.
- From: Ricky Sharp <email@hidden>
- Date: Sat, 30 Sep 2006 17:14:25 -0500
On Sep 30, 2006, at 5:07 PM, Jordan Evans wrote:
I create two NSDates, but the only difference is the month, but the
hour and GMT offset changes, why?
The code:
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSDate *dateOne = [NSDate dateWithString:@"2006-9-02 7:30:12 -0700"];
NSDate *dateTwo = [NSDate dateWithString:@"2006-1-02 7:30:12 -0700"];
NSLog(@"dateOne: %@", [dateOne description]);
NSLog(@"dateTwo: %@", [dateTwo description]);
[pool release];
return 0;
}
The output:
2006-09-30 14:54:39.012 NSDateTest[6958] dateOne: 2006-09-02
07:30:12 -0700
2006-09-30 14:54:39.013 NSDateTest[6958] dateTwo: 2006-01-02
06:30:12 -0800
Looks like something to do with Daylight Saving Time. Do you honor
DST in your time zone? As an experiment, try using a time zone that
doesn't honor DST (e.g. Hawaii); my guess is that the times you
construct will no longer be auto-adjusted.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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