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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -