Monday, 14 March 2011

How to get Current date in iphone

NSDate* date = [NSDate date];
NSDateFormatter* formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
NSString* currentdate = [formatter stringFromDate:date];
NSLog(@"%@",currentdate);

No comments:

Post a Comment