Question

How do I have a textfield with on viewdidLoad load with today's date? i think it requires nsdateformatter but i don't know how to do it if somebody could provide some code. Thank you.

Was it helpful?

Solution

You can try this

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY-MM-dd"];
NSDate *todaysDate = [NSDate date];
NSLog(@"Todays date is %@",[formatter stringFromDate:todaysDate]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top