views:

28

answers:

2

I have a date string like this:

2010-09-04T19:13:00Z

But how do I configure the NSDateFormatter to accept this timezone format? I have tried googling and all, but no luck.

Thank you Søren

A: 
[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
NSDate *date = [formatter dateFromString:'2010-09-04T19:13:00Z'];
jojaba
+1  A: 

Have a look here about what apple recommends.

epatel