objective c - Creating Custom NSString from NSDate -
i need nsstring format "yyyy-mm-dd - 11:00:00"
year, month, , date should current date, while hour, minute, , second should 11,00,00. not figure how that.
i think mean yyyy-mm-dd - hh:mm:ss (because mm minutes , mm month). need
nsdateformatter *formatter = [[nsdateformatter alloc] init]; formatter.dateformat = @"yyyy-mm-dd - hh:mm:ss"; nsstring *string = [formatter stringfromdate:[nsdate date]]; or if want 11:00:00, either pass nsdate, or could:
nsdateformatter *formatter = [[nsdateformatter alloc] init]; formatter.dateformat = @"yyyy-mm-dd' - 11:00:00'"; nsstring *string = [formatter stringfromdate:[nsdate date]];
Comments
Post a Comment