3 Mar 2017

Converting NSDate To NSString With NSDateFormatter...


Converting NSDate To NSString With NSDateFormatter...




NSDate *date = [[NSDate alloc] init];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-YYYY HH:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:date];

NSLog(@"The Date: %@", dateString); 

We can setDateFormate as we like example..
HH:mm a, dd-MMMM-YYYY  like this try different ways....!




No comments:

Post a Comment

Recent Posts

Codable demo

Link: https://www.dropbox.com/s/kw7c1kgv1628bh7/codableDemo.zip?dl=0