其他分享
首页 > 其他分享> > iOS 解析RFC3339时间格式

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为本地时间

标签:nextTime,RFC3339,rfc3339DateFormatter,iOS,alloc,NSDateFormatter,enUSPOSIXLocale,
来源: https://www.cnblogs.com/huaida/p/13131422.html