Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2013 11:56
Show Gist options
  • Save anonymous/5849554 to your computer and use it in GitHub Desktop.
Save anonymous/5849554 to your computer and use it in GitHub Desktop.
ISO 8601 UTC timestamp with milliseconds in Objective-C.
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
dateFormatter.dateFormat = @"YYYY-MM-DD'T'HH:mm:ss.SSS'Z'";
dateFormatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment