ios - NSDateFormatter parses wrong? -
the following code
nsdateformatter* dateformatter = [[[nsdateformatter alloc] init] autorelease]; [dateformatter setdateformat:@"mm/dd/yyyy"]; nsstring* source = @"11/30/2012"; nsdate* date = [dateformatter datefromstring:source]; nslog(@"%@ → %@", source, date); results in output
11/30/2012 → 2012-11-29 15:00:00 +0000
i expected times same. (ie right 2012-11-30 00:00:00 +0000) ...because know input time in utc. output should same time if output time output in utc. time zone issue? left string date should have no timezones specified , nsdate should output utc dates?
printing nsdate directly print date , time in standart format timezone of gmt (+0000), while creation takes system's timezone in account.
you seem 9 hours after gmt/utc.
Comments
Post a Comment