Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is NSEraCalendarUnit?

I was playing around with NSCalendar and NSDateComponents today and I saw constants like NSDayCalendarUnit and NSEraCalendarUnit. NSDayCalendarUnit returns 4 if today is the 4th of December for instance. NSEraCalendarUnit returns the era which is apparently 1 at the time of posting. Anyone care to explain what an era is?

like image 233
hollow7 Avatar asked Nov 26 '11 12:11

hollow7


1 Answers

@Eimantas has it correct. It's AD/BC (or BCE and C.E. for non-Religious folks).

There's a bit more information about it in Apple's Date and Time Programming Guide (linked there). Look under the "Special Considerations for Historical Dates" section.

And the Date & Time Programming Guide's Historical Dates page has even more information, including on working with eras with backward time flow (i.e. the day which follows December 31, 7 BC is January 1, 6 BC).

like image 189
Michael Dautermann Avatar answered Sep 30 '22 14:09

Michael Dautermann