开发者

NSDateFormatter problem with weekday EEE

开发者 https://www.devze.com 2023-01-13 12:32 出处:网络
Why does the following code output: Dday: (null) NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] ini开发者_StackOverflow中文版t];

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

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] ini开发者_StackOverflow中文版t];
[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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消