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);




If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

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