Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

toitoo

macrumors newbie
Original poster
Aug 26, 2009
8
0
Following code is converting string to date successfully when IPhone settings are set to 24 hour clock setting, but it is returning nil when IPhone setting is set to 12 hour clock.

It only returns nil when hour value in string in greater than 12 that means between 13-23.

Code:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];

    [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];

    NSDate *date = [formatter dateFromString:@"2009-10-08T22:10:00"];

    return [date copy];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.