PDA

View Full Version : Get current date on the phone?




ethana
Jul 21, 2008, 02:56 PM
Is there an SDK function to easily get the current date on the iPhone? What's the code to do it?

As a secondary question, is there an easy way to have the date auto-format to the correct country type based off of the iPhones current country settings? Example... US = 07/21/2008, UK = 21.07.2008

Thanks,

Ethan



Limb
Jul 21, 2008, 11:09 PM
NSDate Class Reference (http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDate/description)

Psuedo Code:
NSDate *now = [[NSDate alloc] init];
[lblHello setText:[now description]];

-Limb