0

Possible Duplicate:
convert string to nsdate

The NSString has following value '2012-07-11T15:59:16'

I am unable to determine the correct format for NSDateFomatter.dateFormat property in order to covert it using dateFromString method. I tried 'yyyy-MM-ddTHH:mm:ss' and other similar formats but resultant date is nil.

A link with info about date formatting would be highly appreciated too.

Community
  • 1
  • 1
atastrophic
  • 3,153
  • 3
  • 31
  • 50
  • what is this "T" in the middle?? in this string '2012-07-11T15:59:16' – Leena Jul 16 '12 at 06:46
  • i am wondering too .. It's actually a webservice written in django that is returning date in this format including the 'T' – atastrophic Jul 16 '12 at 06:48
  • @Monolo this is not a duplicate as the other question has answer use NSDateFormatter but this already knows NSDateFormatter – mmmmmm Jul 17 '12 at 11:20
  • 1
    @Leena - the T is what is used in ISO dates http://dotat.at/tmp/ISO_8601-2004_E.pdf – mmmmmm Jul 17 '12 at 11:22

1 Answers1

4

Well you should be able to get it to work if you escape the the T:

 [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
rckoenes
  • 69,092
  • 8
  • 134
  • 166