You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this components to get a NSDate from a string obtained from Facebook API, but I found the NSDate is not right.
I tried the code bellow:
ISO8601DateFormatter* formatter = [[ISO8601DateFormatter alloc] init];
NSDate* date = [formatter dateFromString:@"2014-12-01"];
And I get the date as 2014-11-30 16:00:00 +0000, it's one day before 2014-12-01.
Yes, I'm in China, it looks right if we count the timezone element in.
But, I have tried other components on ISO8601, for example https://github.com/soffes/ISO8601
I tried the code the same as above, and I get the date as 1999-05-01 00:00:00 +0000
I have read the doc, didn't find any clue to get the same result as ISO8601 from this components.
Could you please teach me how to get a date as 2014-11-30 16:00:00 +0000 using this components?
Thanks in advance.
BR,
roby
The text was updated successfully, but these errors were encountered:
With this change, you'll be able to set formatter.defaultTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"] to have dateFromString: resolve the components in UTC. Then that string returns the date you expected.
If I'm reading you right, @soffes's parser resolved that to 1995? You should file a bug report for that project, I think.
Hi,
I'm using this components to get a NSDate from a string obtained from Facebook API, but I found the NSDate is not right.
I tried the code bellow:
ISO8601DateFormatter* formatter = [[ISO8601DateFormatter alloc] init];
NSDate* date = [formatter dateFromString:@"2014-12-01"];
And I get the date as 2014-11-30 16:00:00 +0000, it's one day before 2014-12-01.
Yes, I'm in China, it looks right if we count the timezone element in.
But, I have tried other components on ISO8601, for example https://github.com/soffes/ISO8601
I tried the code the same as above, and I get the date as 1999-05-01 00:00:00 +0000
I have read the doc, didn't find any clue to get the same result as ISO8601 from this components.
Could you please teach me how to get a date as 2014-11-30 16:00:00 +0000 using this components?
Thanks in advance.
BR,
roby
The text was updated successfully, but these errors were encountered: