• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting an era's beginning date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting an era's beginning date


  • Subject: Re: Getting an era's beginning date
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 28 Jan 2008 20:11:33 -0800

On 平成 20/01/28, at 16:39, 慧 松本 wrote:

On 2008/01/29, at 8:49, Nick Zitzmann wrote:

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 am a Japanese.

"January 7, 1989" is the date that our current emperor was enthroned. Each emperor had his own eras. Some emperors changed their eras when a disaster or evil thing had happened.
As our imperial family has continued for more than 2000 years, there are hundreds of eras in Japanese calendar.


I don't think it is realistic for NSCalendar to have Japanese era database.

Realistic or not, they did it. =) I think the Japanese calendar support was added in Tiger; the era names go back to Taika in 645 AD. I found that I can get at least the year by using something like this:


jp = [[NSCalendar alloc] initWithCalendarIdentifier:@"japanese"];
components = [NSDateComponents alloc] init];
[components setEra:235]; // Heisei; Taika is 0.
date = [jp dateFromComponents: components]; // date is 1989-01-01 00:00:00 -0800


Notice, however, that the day is wrong. I don't know if that's a deficiency in my code or in the era data itself.


--Chris Nebel _______________________________________________

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


  • Follow-Ups:
    • Re: Getting an era's beginning date
      • From: 慧 松本 <email@hidden>
    • Re: Getting an era's beginning date
      • From: Nick Zitzmann <email@hidden>
References: 
 >Getting an era's beginning date (From: Nick Zitzmann <email@hidden>)
 >Re: Getting an era's beginning date (From: 慧 松本 <email@hidden>)

  • Prev by Date: [Job] Cocoa developer wanted
  • Next by Date: Re: Drag and Drop Focus problem....
  • Previous by thread: [WORKAROUND] Re: Getting an era's beginning date
  • Next by thread: Re: Getting an era's beginning date
  • Index(es):
    • Date
    • Thread