I want to print NSDate in NSLog, but its not printing date correctly.
NSDateFormatter *format = [NSDateFormatter new];
[format setDateFormat: @"YYYY-MM-DD"];
NSDate *date = [NSDate date];
NSLog(@"Date: %@",format);
Can anyone tell me, what's wrong in my code..!
Tarun Kumar
07-Dec-2015To print date in NSLog use stringFromDate method of NSDateFormatter class.
Here, we provide the example, change your code by this code: