I want current time in following format in a string.
dd-mm-yyyy HH:MM
How?
You want a date formatter. Here's an example:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"dd-MM-yyyy HH:mm"]; NSDate *currentDate = [NSDate date]; NSString *dateString = [formatter stringFromDate:currentDate];
2.1m questions
2.1m answers
60 comments
57.0k users