Behind The Scenes: Core Data dates stored with 31 year offset?

Core Data stores dates relative to reference date, which is Jan 1st, 2001 (31 years after EPOCH as pointed out in the comments)

Here’s some code to decode the dates from the table, in case it is useful to you.

NSNumber *time = [NSNumber numberWithDouble:(d - 3600)];
NSTimeInterval interval = [time doubleValue];    
NSDate *online = [NSDate dateWithTimeIntervalSinceReferenceDate:interval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MM/dd/yyyy HH:mm:ss.SSS"];

NSLog(@"result: %@", [dateFormatter stringFromDate:online]);

https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/Reference/Reference.html

Take a look at + dateWithTimeIntervalSinceReferenceDate:

Leave a Comment