0

I am getting the date string from the server as 2012-06-21 18:13:33 -04:00

  • What is the correct date format to be set for dateformatter to retrive date from string.

  • I had tried using format [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss z"];
    but I am getting nil in return.

Pfitz
  • 7,276
  • 4
  • 37
  • 51
Javal Nanda
  • 1,818
  • 3
  • 14
  • 26

2 Answers2

0

The documentation says you can use 1..3 Z. So how about this one:

@"yyyy-MM-dd HH:mm:ss ZZZ"
Paul de Lange
  • 10,605
  • 10
  • 40
  • 56
0

The one suggested by Paul de Lange won't work. This is the reason: iPhone NSDateFormatter Timezone Conversion

In short, you will have to change your source data because this is a non-standard format.

Community
  • 1
  • 1
Stavash
  • 14,180
  • 5
  • 51
  • 80