I have date strings similar to these:
2013-01-25 00:00:00 -0500 2013-01-22 00:00:00 -0700 2013-01-26 00:00:00 -0200
I want to use NSDateFormatter
to create an NSDate
using these string types. I know how to use the formatter to get the first part of the date ( 2013-01-25 00:00:00
), but I do not know how to specify the offset ( -0500
, -0200
, etc.). Here's the code to start the date string:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy'-'MM'-'dd HH':'mm':'ss"]; NSString *dateString = @"2013-01-25 00:00:00";
How can I make it work with the -0500
part? I tried SSSZ
but it did not work (given null
).
source share