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];
沒有確切的答案。 –
可以顯示烏爾試圖代碼 –