-2

I will appreciate if someone could please advise me what is wrong with the date formatting. I have the following date as string from webservice :

20141211200300 //yyyyMMddHHmmss -->2014/12/11 20:03:00

But when I format it using the following format it adds 2 hrs

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyyMMddHHmmss"];
NSDate *date = [dateFormatter dateFromString:localDate];

The output I get in console is

2014-12-11 10:03:00 +0000

I tried adding GMT timezone as well as Australia/Brisbane still get the same issue.

2
  • Thank you @Zaph yes I am using NSLog(). I will accept your answer. Dec 11, 2014 at 11:43
  • oh dear... when do they learn to deal with timezones?
    – holex
    Dec 11, 2014 at 13:53

1 Answer 1

0

You did not show the code that printed the number. If you used NSLog() there is probably a time zone issue, Note that the printed time is in GMT. Is your time zone two hours from GMT?

Not the answer you're looking for? Browse other questions tagged or ask your own question.