Date Stamp into a String

201 Views Asked by At

I'm sure this is a easy problem, but I just can not seem to find how to do this anywhere. I need to use the current Date and save it into a String. I do not know how to get the dat stamp. Could someone please help me out? Thank you for your time! -Jeff

2

There are 2 best solutions below

0
On BEST ANSWER

You will need to set your format according to the docs

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MM-dd-yy"];
NSString *date = [formatter stringFromDate:[NSDate date]];
0
On

Use NSDateFormatter, heres a link with examples