What is the range for the DATE type in Core Data?
-
06-07-2019 - |
Question
I'm putting together an application that will require the recording of dates as far back as the BC range; can Core Data's date
type handle this, or do I need to define another entity to properly record and format dates?
Solution
NSDate works using NSTimeInterval which is a double.
always specified in seconds; it yields sub-millisecond precision over a range of 10,000 years.
I'm not going to work out how far back in time a double will go (order of +/- 10^300 seconds or so), but I think you will be safe to use it for the BC ranges. For example: 1,000 years is about 3x10^11 seconds.
OTHER TIPS
Perhaps this is useful, NSDate distantPast
gives you:
0001-12-31 19:43:12 -041648
and NSDate distantFuture
gives you:
4000-12-31 21:00:00 -0300
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow