Search code examples
iosdatetimensdatenstimeinterval

Getting date from NSNumber


I have date in value (long)1396267211 - How can I get NSDate from it? I think that it is a NSTimeINterval but I am not sure.


Solution

  • [NSDate dateWithTimeIntervalSince1970:[yourNumber doubleValue]]
    

    Double value to make sure it follows NSTimeInterval precision.