views:

78

answers:

2

Hello,

Why does the following code output: Dday: (null)

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEE HH:mm:ss"];
NSDate *date = [dateFormatter dateFromString:@"Sun 15:00:00"];
DLog(@"Ddate: %@", date);

If I use the format HH:mm:ss and string 15:00:00 i get a valid date...

Cheers mate

A: 

Are you sure it should be EEE not eee? I was using eee and it works fine.

sha
Yeah pretty sure since the standards suggests EEE and when going date to string EEE is working like a charm.
objneodude
A: 

It may be related to the locale of your system/device, have a look at the following from apple

http://developer.apple.com/mac/library/qa/qa2010/qa1480.html

Liam
Thanks saved the day.
objneodude