Reputation: 51
I work with API and I need to convert NSInterval to date.
For example, I have NSNumber model.complaintCreatedTime = 1480550400000
.I try this method, but it doesn't work:
NSDate* date = [NSDate dateWithTimeIntervalSinceReferenceDate :[(NSString *)model.complaintCreatedTime doubleValue ]];
Mb API developers wrote the bad request to created API? Pls, smbd help me!
Upvotes: 0
Views: 371
Reputation: 121
the unit is second,not millisecond。maybe you should try [NSDate dateWithTimeIntervalSince1970:1480550400]
Upvotes: 0
Reputation: 285270
Most likely you are using the wrong API and your time stamp is in milliseconds
NSDate* date = [NSDate dateWithTimeIntervalSince1970: model.complaintCreatedTime.doubleValue / 1000];
Upvotes: 2