Created
September 8, 2014 09:20
-
-
Save takuya-i/4012bdd235eed282eaaf to your computer and use it in GitHub Desktop.
Rails4のtimestampをUTCのままNSDateに変換する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]]; | |
//"2014-09-05T03:37:21.000Z" | |
dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.000Z"; | |
NSDate * lastDate = [dateFormatter dateFromString:@"2000-12-31T12:12:12.000Z"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment