The messageDateString
method is returning milliseconds since the epoch, not seconds since the epoch. Look at the value of unixTimeStamp
in your debugger pane. It's 1384803782032. That is about 1000 times too large to be a current Unix timestamp.
An NSTimeInterval
is measured in seconds, not milliseconds. Try this instead:
-(NSDate *)messageDate {
NSTimeInterval unixTimeStamp = [[self messageDateString] doubleValue] / 1000.0;
NSDate *messageDate = [NSDate dateWithTimeIntervalSince1970:unixTimeStamp];
NSAssert(messageDate, @"messageDate should not be nil");
return messageDate;
}