iOS 解析RFC3339时间格式

https://www.ietf.org/rfc/rfc3339.txt

https://zhuanlan.zhihu.com/p/31829454

  NSDateFormatter *rfc3339DateFormatter = [[NSDateFormatter alloc] init];

    NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];

    [rfc3339DateFormatter setLocale:enUSPOSIXLocale];

    [rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"];

    [rfc3339DateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];

    NSDate *nextTime = [rfc3339DateFormatter dateFromString:self.next_funding_at];

nextTime为本地时间

上一篇:OC特殊语法


下一篇:关于IOS UIlable 一行未满就换行