-6

可能重复:
将 NSDate 格式化为 DDMMYYYY?
想要 2000 年 1 月或 2000 年 1 月的 NSDateformatter

我需要以下格式的日期和时间。我怎样才能得到 ..

2012-12-17 05:30

4

2 回答 2

0

你可以随时用谷歌搜索这类问题

尝试查看NSDateFormatter类,
您要查找的格式类似于:

 [dateFormatter setDateFormat:@"MMM dd,yyy hh:mm:ss a"]; //dateFormatter is an object of class NSDateFormatter
于 2012-12-17T13:22:20.680 回答
0
    NSDate *selected_Date = //Your Date object here;
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"MMM dd,yyy hh:mm:ss a"];
    NSString* strDateObj [NSString stringWithFormat:@"%@",[dateFormat stringFromDate:selected_Date]];
    NSLog(@"Date %@",)
于 2012-12-17T13:59:34.723 回答