iPhone: NSDate convert GMT to local time

后端 未结 4 1547
渐次进展
渐次进展 2020-12-14 11:49

I currently have an API call returning me a date/time in the format: 2010-10-10T07:54:01.878926

Can I assume this is GMT? I also converted this to an NS

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 12:28

    NSDate *now = [NSDate date];
    NSLog(@"%@", [now dateWithCalendarFormat:@"%Y-%m-%d %H:%M:%S" 
                  timeZone:[NSTimeZone timeZoneWithName:@"GMT"]]);
    

提交回复
热议问题