title: ISO8601 datetime generate (Like Y-m-d\TH:i:s\Z)
body: <p>How can I generate (iOS 7) <code>ISO 8601</code> datetimes like <code>Y-m-d\TH:i:s\Z</code> in PHP?</p>
  
  <hr>
  
  <p>PHP Code:</p>
  
  <pre><code>gmdate('Y-m-d\TH:i:s\Z'); // Output: 2014-02-12T12:08:43Z
  </code></pre>
  
  <p>Objective-C: (Looking around the web I found this code, but its not returning exactly ISO 8601)</p>
  
  <pre><code>- (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];
  }
  </code></pre>