I can print out a date nicely based on the user's locale. But how could I get a string with the date+time format?
views:
44answers:
1
+1
A:
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterMediumStyle];
NSLog(@"The date and time is %@", [formatter stringFromDate:[NSDate date]]);
Darren
2009-08-29 19:43:37
Perfect! I was getting an empty string all the time because I didn't explicitely set those styles. wasted 5 hours of my life ;-)
HelloMoon
2009-08-29 19:53:07