Getting an era's beginning date
Getting an era's beginning date
- Subject: Getting an era's beginning date
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 28 Jan 2008 16:49:05 -0700
What's the best way of getting the start date for a given era in an
NSCalendar?
For days, weeks, etc. this is trivial, since they have a universal
start time. But an era can begin and end at any point in time. These
points in time are trivial to figure out on the Gregorian calendar
(the AD era began on January 1, 1), but the Japanese calendar is a
totally different story (the Heisei era began on January 7, 1989 for
example).
I've tried to solve this by polling NSCalendar for era changes, by
getting the date for the first day in the era (which may not actually
be in the era) and stepping through days until the era of the day
matches the desired era, but this takes way too long to calculate for
all eras on the Japanese calendar, so I'm hoping there's a better way.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden