NSDate and NSDateFormatter

- by

Hey Jay, Great Idea. Here’s a little snippet of code that grabs the current date, then using a couple of NSDateFormatter methods converts it to the current time.

NSDate *today = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"HH:mm"];
NSString *myString =[formatter stringFromDate:today];
NSLog(@"%@",myString);


Add your voice!

This site uses Akismet to reduce spam. Learn how your comment data is processed.