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];
我又用模拟器测试了一下,发现存在同样的问题,也就是说跟手机型号有关,系统版本无关,请问如何适配?
怪我咯2017-04-17 17:39:46
Send the value of appointmentServiceTime
. appointmentServiceTime
的值发一下。
应该是你[self.appointmentServiceTime integerValue]
这个的问题,
换成doubleValue
就都一样了。
应该是4s上integerValue
是int_32,
而是5s上integerValue
是int_64,
所以你的1457107200000
It should be your [self.appointmentServiceTime integerValue]
problem. If
doubleValue
, it will be the same. #🎜🎜# should be that integerValue
is int_32 on 4s, #🎜🎜# but integerValue
is int_64 on 5s, #🎜🎜# so your 1457107200000< /code>This value is greater than the range of 32-bit int values. #🎜🎜#So there is a problem on 4s. #🎜🎜#reply0
PHPz2017-04-17 17:39:46
You can just parse it directly into Y-m-d H:i:s and give it to the client
巴扎黑2017-04-17 17:39:46
Please refer here:
http://www.henishuo.com/ios-timestamp-date-converted/
Written an extension, which is often used in development