public static int fixed_from_dmy(int day, int month, int year) { int num = -1373428; num += CCHebrewCalendar.elapsed_days(year); num += CCHebrewCalendar.new_year_delay(year); if (month < 7) { int num2 = CCHebrewCalendar.last_month_of_year(year); for (int i = 7; i <= num2; i++) { num += CCHebrewCalendar.last_day_of_month(i, year); } for (int i = 1; i < month; i++) { num += CCHebrewCalendar.last_day_of_month(i, year); } } else { for (int i = 7; i < month; i++) { num += CCHebrewCalendar.last_day_of_month(i, year); } } return(num + day); }
internal int M_Month(int ccmonth, int year) { if (ccmonth >= 7) { return(ccmonth - 6); } int num = CCHebrewCalendar.last_month_of_year(year); return(ccmonth + ((num != 12) ? 7 : 6)); }
/// <summary> /// The method maps a Calendrical Calculations Hebrew month /// to a .NET Hebrew month. /// </summary> /// <param name="ccmonth">An integer representing a month in /// Calendrical Calculations counting, starting with Nisan. /// </param> /// <param name="year">An integer representing the Hebrew year. /// </param> /// <returns>The Hebrew month in .NET counting, /// staring with the Hebrew month Tishri. /// </returns> /// <remarks> /// <para> /// In .NET the month counting starts with the Hebrew month Tishri. /// Calendrical Calculations starts with the month Tisan. So we must /// map here. /// </para> /// </remarks> internal int M_Month(int ccmonth, int year) { if (ccmonth >= 7) { return(ccmonth - 6); } else { int l = CCHebrewCalendar.last_month_of_year(year); return(ccmonth + (l == 12 ? 6 : 7)); } }
internal void M_CheckYME(int year, int month, ref int era) { this.M_CheckYE(year, ref era); int num = CCHebrewCalendar.last_month_of_year(year); if (month < 1 || month > num) { StringWriter stringWriter = new StringWriter(); stringWriter.Write("Month must be between 1 and {0}.", num); throw new ArgumentOutOfRangeException("month", stringWriter.ToString()); } }
internal int M_CCMonth(int month, int year) { if (month <= 6) { return(6 + month); } int num = CCHebrewCalendar.last_month_of_year(year); if (num == 12) { return(month - 6); } return((month > 7) ? (month - 7) : (6 + month)); }
/// <summary> /// The method maps a .NET Hebrew month to a Calencdrical /// Calculations Hebrew month. /// </summary> /// <param name="month">An integer representing a month in .NET /// counting (starting with Tishri). /// </param> /// <param name="year">An integer representing the Hebrew year. /// </param> /// <returns>The Hebrew month in Calendrical Calculations counting, /// staring with the Hebrew month Nisan. /// </returns> /// <remarks> /// <para> /// In .NET the month counting starts with the Hebrew month Tishri. /// Calendrical Calculations starts with the month Nisan. So we must /// map here. /// </para> /// </remarks> internal int M_CCMonth(int month, int year) { if (month <= 6) { return(6 + month); } else { int l = CCHebrewCalendar.last_month_of_year(year); if (l == 12) { return(month - 6); } else { return(month <= 7 ? 6 + month : month - 7); } } }
/// <summary> /// Overridden. Gives the number of months in the specified year /// and era. /// </summary> /// <param name="year">An integer that specifies the year. /// </param> /// <param name="era">An integer that specifies the era. /// </param> /// <returns>An integer that gives the number of the months in the /// specified year.</returns> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// The exception is thrown, if the year or the era are not valid. /// </exception> public override int GetMonthsInYear(int year, int era) { M_CheckYE(year, ref era); return(CCHebrewCalendar.last_month_of_year(year)); }