在iOS上以ISO 8601格式化時間[復制]

[英]Format time in ISO 8601 on iOS [duplicate]


This question already has an answer here:

這個問題在這里已有答案:

How do I get the current time and format it to ISO 8601?

如何獲取當前時間並將其格式化為ISO 8601?

By these I mean the format: YYYY-MM-DDTHH:MM:SSZ where T and Z are not time represented; they are constants.

通過這些我的意思是格式:YYYY-MM-DDTHH:MM:SSZ其中T和Z不是時間代表;它們是常數。

1 个解决方案

#1


0  

The way to achieve this is by:

實現這一目標的方法是:

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm'Z'"];
    NSDate *date = [NSDate date];
    NSLog(@"%@",[dateFormatter stringFromDate:date]);

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2015/02/02/7204029f3c27e127433e1f7b78b925a4.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com