objective c - Get current NSDate with a format of: dd/MM/yyyy -
i'm trying current date following format: dd/mm/yyyy
.
the way format it, this:
nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"dd/mm/yyyy"];
and current date this: [nsdate date]
. how can mix 2 together, , current date format?
if want current day format this: dd/mm/yyyy.
you can use code:
nsdate *datecenter = [nsdate date]; nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"d, mmmm, yyyy"]; nsstring *datestring = [dateformat stringfromdate:datecenter]; lbldaymonthyear.text = datestring;
Comments
Post a Comment