Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6827093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:13:32+00:00 2026-05-26T22:13:32+00:00

I conducted a quick test with the Cocoa Touch to see how NSHebrewCalendar works.

  • 0

I conducted a quick test with the Cocoa Touch to see how NSHebrewCalendar works. I’m particularly interested in the month numbers. I used a date picker to easily change dates, and I passed it in to a method which logs the hebrew date, the hebrew month number, the hebrew year, and if the year is leap year. That looks like this:

BOOL isHebrewLeapYear = [self.calendar isHebrewLeapYear:[calendar hebrewYearForDate:[self.calendar workingDate]]];

NSLog(@"Hebrew Date:%@, Month Number: %i, %i is Leap Year: %i", [self.calendar stringFromHebrewDate:[self.calendar workingDate]], [self.calendar hebrewMonthNumberFromDate:[self.calendar workingDate]], [calendar hebrewYearForDate:[self.calendar workingDate]], isHebrewLeapYear);    

The self.calendar object is a custom class. The workingDate property is an NSDate instance. Here are the relevant method declarations.

//  Check if a given year is a leap year
- (BOOL) isHebrewLeapYear:(NSInteger)year{
    return ((7 * year + 1) % 19) < 7;
}

//Get the hebrew year for a given date
- (NSInteger) hebrewYearForDate:(NSDate *)date{
   NSCalendar *hebrewCalendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSHebrewCalendar] autorelease];
   return [[hebrewCalendar components:NSYearCalendarUnit fromDate:date] year];
}

- (NSInteger) hebrewMonthNumberFromDate:(NSDate *)date{
    NSCalendar *hebrewCalendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSHebrewCalendar] autorelease];
    return [[hebrewCalendar components:NSMonthCalendarUnit fromDate:date] month];
}

Apparently hebrew leap years are handled as follows:

  • Month numbering starts at 1, with that month being “Tishri”.
  • In a nonleap year, Adar is month number 7, not 6.
  • In a leap year, Adar I is number 6 and Adar II is 7.
  • “Nisan” is always 8 and so on until “Elul”, which is always 13.

Does it sound like my experiment is producing accurate results? Is this behavior documented anywhere?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:13:33+00:00Added an answer on May 26, 2026 at 10:13 pm

    Month numbering starts at 1, with that month being “Tishri”.

    Correct.

    In a nonleap year, Adar is month number 7, not 6.

    Technically incorrect. (More on this below)

    In a leap year, Adar I is number 6 and Adar II is 7.

    Correct.

    “Nisan” is always 8 and so on until “Elul”, which is always 13.

    Correct.

    So what’s up with Adar in non-leap years? I ran this code to find out:

    @autoreleasepool {
    
        NSDate *today = [NSDate date];
        NSCalendar *hebrew = [[NSCalendar alloc] initWithCalendarIdentifier:NSHebrewCalendar];
        NSDateComponents *diff = [[NSDateComponents alloc] init];
        NSDateFormatter *f = [[NSDateFormatter alloc] init];
        [f setDateFormat:@"d MMMM y"];
        [f setCalendar:hebrew];
    
        for (NSInteger i = 0; i < 19; ++i) {
            NSDateComponents *comp = [[NSDateComponents alloc] init];
            [comp setYear:5772 + i];
            [comp setDay:1];
    
            NSLog(@"============= %d ============", [comp year]);
    
            for (NSInteger i = 1; i <= 13; ++i) {
                [comp setMonth:i];
    
                NSDate *d = [hebrew dateFromComponents:comp];
                NSLog(@"%d: %@ (%@)", i, [f stringFromDate:d], d);
            }
        }
    
    }
    

    In a leap year, this will log what you would expect:

    ============= 5790 ============
    1: 1 Tishri 5790 (2029-09-10 07:00:00 +0000)
    2: 1 Heshvan 5790 (2029-10-10 07:00:00 +0000)
    3: 1 Kislev 5790 (2029-11-08 08:00:00 +0000)
    4: 1 Tevet 5790 (2029-12-07 08:00:00 +0000)
    5: 1 Shevat 5790 (2030-01-05 08:00:00 +0000)
    6: 1 Adar I 5790 (2030-02-04 08:00:00 +0000)
    7: 1 Adar II 5790 (2030-03-06 08:00:00 +0000)
    8: 1 Nisan 5790 (2030-04-04 07:00:00 +0000)
    9: 1 Iyar 5790 (2030-05-04 07:00:00 +0000)
    10: 1 Sivan 5790 (2030-06-02 07:00:00 +0000)
    11: 1 Tamuz 5790 (2030-07-02 07:00:00 +0000)
    12: 1 Av 5790 (2030-07-31 07:00:00 +0000)
    13: 1 Elul 5790 (2030-08-30 07:00:00 +0000)
    

    For each incrementation of the “month” date component, we get a different date. But when we run this in a non-leap year, we get this:

    ============= 5789 ============
    1: 1 Tishri 5789 (2028-09-21 07:00:00 +0000)
    2: 1 Heshvan 5789 (2028-10-21 07:00:00 +0000)
    3: 1 Kislev 5789 (2028-11-19 08:00:00 +0000)
    4: 1 Tevet 5789 (2028-12-19 08:00:00 +0000)
    5: 1 Shevat 5789 (2029-01-17 08:00:00 +0000)
    6: 1 Adar 5789 (2029-02-16 08:00:00 +0000)
    7: 1 Adar 5789 (2029-02-16 08:00:00 +0000)
    8: 1 Nisan 5789 (2029-03-17 07:00:00 +0000)
    9: 1 Iyar 5789 (2029-04-16 07:00:00 +0000)
    10: 1 Sivan 5789 (2029-05-15 07:00:00 +0000)
    11: 1 Tamuz 5789 (2029-06-14 07:00:00 +0000)
    12: 1 Av 5789 (2029-07-13 07:00:00 +0000)
    13: 1 Elul 5789 (2029-08-12 07:00:00 +0000)
    

    Here we see that have a month of 6 and 7 will both evaluate to Adar. Thus, Adar is both the 6th and the 7th month in non-leap years.


    Also, since we know that the year 5790 is a leap year, we can deduce a simpler implementation of the -isHebrewLeapYear: method:

    - (BOOL) isHebrewLeapYear:(NSInteger)year{
        return year % 19 == 14;
    }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi recently I conducted a test on two different ubuntu servers. Here are the
I am interested in how the reverse-engineering on java bytecode is conducted. Can anyone
I'm in a bit of a doubt about this subject. Situation: I have conducted
In my test project, I created a WCF service and got it running. Next,
I am unsure of whether this is possible and have conducted a handful of
Just a quick question: There's the entity (for example User) who is connected with
Just a quick question. I'm making a web application where C++ communicates with a
A quick question, I am setting a delegate for UITableView and I have a
I need to knock up a very quick prototype/proof of concept application to demo
I need to create a quick and dirty solution to migrate data from database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.