I'm using an NSDateFormatter to format an NSDate to be in the format "HH:mm 'on' dd MMMM YYYY".
This is the code I've written:
[dateFormatter setDateFormat:@"HH:mm 'on' dd MMMM YYYY"];
[dateFormatter setLocale:[NSLocale currentLocale]];
Then I'm updating a label to display "Data from 12:45 on 22 September 2010", using the method stringFromDate.
NSString *timeAndDateUpdated = [[NSString alloc] initWithFormat:@"Data from %@.", [dateFormatter stringFromDate:date]]
The label is updated correctly if the time on the iPhone is set to 24-hour, but if it's set to 12-hour, the label displays "Data from (null)".
Does anyone know how to solve this problem?
Thanks.