当我们在java(new Date()
)中获取日期时,格式为“Tue May 13 13:37:06 UTC 2014”。如何在目标c中获得此格式?
答案 0 :(得分:0)
这就是你得到的...... .. :)
NSDate *newDate = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"]; // set here your own
NSString *currentDate = [formatter stringFromDate:newDate];