What is an NSEraCalendarUnit?

I played with NSCalendar and NSDateComponents today, and I saw constants like NSDayCalendarUnit and NSEraCalendarUnit. NSDayCalendarUnit returns 4 if today, for example, is December 4th. NSEraCalendarUnit returns an era that is apparently 1 at the time of publication. Does anyone want to explain what an era is?

+6
source share
1 answer

@ Eimantas has it right. This is AD / BC (or BCE and CE for non-religious people).

There's a bit more information on this in the Apple Date and Time Programming Guide (ibid.). See the section Special Considerations for Historical Dates.

And the page with the date and time of programming Historical dates contains additional information, including on working with epochs with a reverse flow of time (that is, on the day that follows December 31, 7 BC - January 1, 6 BC E. ).

+8
source

Source: https://habr.com/ru/post/902442/


All Articles