4s是7.1
5s是9.2
百度找不到答案,感觉是系统问题,下面是代码
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:[self.appointmentServiceTime integerValue]/1000];
[formatter setDateFormat:@"YYYY.MM.dd"];
NSString *str = [formatter stringFromDate:confromTimesp];
我又用模拟器测试了一下,发现存在同样的问题,也就是说跟手机型号有关,系统版本无关,请问如何适配?
Send the value of
appointmentServiceTime
.appointmentServiceTime
的值发一下。应该是你
is replaced with[self.appointmentServiceTime integerValue]
这个的问题,换成
doubleValue
就都一样了。应该是4s上
integerValue
是int_32,而是5s上
integerValue
是int_64,所以你的
1457107200000
It should be your
[self.appointmentServiceTime integerValue]
problem. IfdoubleValue
, it will be the same. #🎜🎜# should be thatintegerValue
is int_32 on 4s, #🎜🎜# butintegerValue
is int_64 on 5s, #🎜🎜# so your1457107200000This value is greater than the range of 32-bit int values. #🎜🎜#So there is a problem on 4s. #🎜🎜#
You can just parse it directly into Y-m-d H:i:s and give it to the client
Please refer here:
http://www.henishuo.com/ios-timestamp-date-converted/
Written an extension, which is often used in development