Edit: Updating post based on Martins comments below
Hello,
I’m just trying to get a date from a string, my code is as follows:
NSString *strStartDateTime = [startTimeArray objectAtIndex:i];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *dtStartDateTime;
dtStartDateTime = [formatter dateFromString: strStartDateTime];
strStartDateTime has a value of ‘2010-09-30 15:23:30’, but this code returns a value of ‘2010-09-30 14:23:30 GMT’, all I want is ‘2010-09-30 15:23:30’ as per the string.
Is it taking Day light Savings Time into consideration. This is very frustrating, I simply want to convert the NSString to NSDate and its changing the value.
Regards,
Stephen
I don’t quite understand your question. What do you mean by “it gives me the GMT value”? What is your input? What is your expected output?
If you have problems with time zone conversions, you could try to set the time zone for the formatter:
or
As I said, it all depends on what the input and expected output is.
EDIT:
You actually don’t have a problem. The date is parsed correctly. You can verify it this way: