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.

Était-ce utile?

La 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]);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top