0

I have this date string:

2014-03-09T00:00:00+01:00

Tried to parse it to timestamp using this code:

NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-mm-dd'T'HH:mm:ss"];
NSDate *date = [dateFormatter dateFromString:response];
NSLog(@"%@", date);
NSTimeInterval timestamp = [date timeIntervalSince1970];

But it always returns nil in NSLog. What is the proper dateFormat for my date string?

I use same date format in Android app and it works but does not in Obj-C.

Rendy
  • 5,572
  • 15
  • 52
  • 95

1 Answers1

1

Try this:

[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssXXX"];
metronic
  • 455
  • 5
  • 15