I try to convert my NSString to NSDate object, but NSDateFormatter returns me a strange value.
Here is code:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm"];
NSDate *date = [dateFormat dateFromString:@"2012-08-15 00:00"];
[dateFormat release];
date value is 2012-08-14 21:00 +0000. It is 3 hours difference between NSString value and NSDate value. I think I’ve missed something, but I don’t know what.
This is what i use:
The
+0000is timezone, so make sure you use your timezone, like+0400.Edit:
If you can’t change the string, you can use this code to do it: