0
我得到了服务器的响应日期。
"createTime": "2016-10-07T19:22:34.3192343+00:00"
根据日期变化我想检查它在设备上(分钟,小时,天,月)年完成。
一个办法,如何计算完成的时间? 根据服务请求"createTime" : "2016-10-07T19:22:34.3192343+00:00"
结果值应该是30分钟。术后第2天1小时1:30分后,这将是2天
我得到了服务器的响应日期。
"createTime": "2016-10-07T19:22:34.3192343+00:00"
根据日期变化我想检查它在设备上(分钟,小时,天,月)年完成。
一个办法,如何计算完成的时间? 根据服务请求"createTime" : "2016-10-07T19:22:34.3192343+00:00"
结果值应该是30分钟。术后第2天1小时1:30分后,这将是2天
NSString* format = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
// Set up an NSDateFormatter for UTC time zone
NSDateFormatter* formatterUtc = [[NSDateFormatter alloc] init];
[formatterUtc setDateFormat:format];
[formatterUtc setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
// Cast the input string to NSDate
NSDate* utcDate = [formatterUtc dateFromString:[formatterUtc stringFromDate:@""2016-10-07T19:22:34.3192343+00:00" "]];
// Set up an NSDateFormatter for the device's local time zone
NSDateFormatter* formatterLocal = [[NSDateFormatter alloc] init];
[formatterLocal setDateFormat:format];
[formatterLocal setTimeZone:[NSTimeZone localTimeZone]];
// Create local NSDate with time zone difference
NSDate* localDate = [formatterUtc dateFromString:[formatterLocal stringFromDate:utcDate]];
NSTimeInterval seconds = [[NSDate date] timeIntervalSinceDate:localDate];
没有确切的答案。 –
可以显示乌尔试图代码 –