How can I generate (iOS 7) ISO 8601
datetimes like Y-m-d\TH:i:s\Z
in PHP?
PHP Code:
gmdate('Y-m-d\TH:i:s\Z'); // Output: 2014-02-12T12:08:43Z
Objective-C: (Looking around the web I found this code, but its not returning exactly ISO 8601)
- (NSString *)timestampISO8601 // Output: 2014-02-12T10:12:19-02:00
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
NSDate *date = [NSDate date];
return [dateFormatter stringFromDate:date];
}