How can I get the current date, and format it like "20/12/2010"?
Thanks in advance..:)
How can I get the current date, and format it like "20/12/2010"?
Thanks in advance..:)
Break it down.
How do I get the current date? See NSDate.
How do I format a date in a specific format? See NSDateFormatter.
Use NSDate and NSDateFormatter.
NSDate *today = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"dd/MM/yyyy"];
NSString *dateString = [dateFormat stringFromDate:today];
NSLog(@"date: %@", dateString);