• 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: Nick Zitzmann <email@hidden>
  • Date: Mon, 28 Jan 2008 21:31:20 -0700


On Jan 28, 2008, at 9:11 PM, Christopher Nebel wrote:

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.


The date is actually correct. This is why I wanted to know the method of getting an era's beginning date, because eras, unlike years, months, and days, can begin and end at any time on a calendar.

In the case of the Japanese calendar, the 235th era is indeed the Heisei era, but since you didn't specify year & date components, NSCalendar assumes you meant the first year/month/day in that time frame. The first year of the Heisei era is 1989, but January 1, 1989 is actually in the Showa (234th) era.

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


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

  • Prev by Date: Re: Drag and Drop Focus problem....
  • Next by Date: keeping view's bounds fixed
  • Previous by thread: Re: Getting an era's beginning date
  • Next by thread: Re: Getting an era's beginning date
  • Index(es):
    • Date
    • Thread