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,336
  • 4
  • 38
  • 51
Javal Nanda
  • 1,828
  • 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,613
  • 10
  • 41
  • 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,244
  • 5
  • 52
  • 80