3 // (C) Ulrich Kunitz 2002
7 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 namespace System
.Globalization
{
35 /// This is the Hebrew calendar.
38 /// <para>The Hebrew calendar supports only years between 5343 A.M. and
39 /// 6000 A.M. This has been done to be compatible with .NET.
41 /// <para>The implementation uses the
42 /// <see cref="N:CalendricalCalculations"/> namespace.
46 [MonoTODO ("Fix serialization compatibility with MS.NET")]
47 public class HebrewCalendar
: Calendar
{
51 public HebrewCalendar() {
52 M_AbbrEraNames
= new string[] {"A.M."}
;
53 M_EraNames
= new string[] {"Anno Mundi"}
;
54 if (M_TwoDigitYearMax
== 99)
55 M_TwoDigitYearMax
= 5790;
59 /// The era number for the Anno Mundi (A.M.) era, called
62 public static readonly int HebrewEra
= 1;
66 /// <see cref="T:System.DateTime"/> ticks for first day of year
69 internal const long M_MinTicks
= 499147488000000000L;
72 /// <see cref="T:System.DateTime"/> ticks for the last day of year
75 internal const long M_MaxTicks
= 706783967999999999L;
77 /// The minimum year in the A.M. era supported.
79 internal const int M_MinYear
= 5343;
81 /// The maximum year supported in the A.M. era.
83 internal override int M_MaxYear
{
87 /// <value>Overridden. Gives the eras supported by the Gregorian
88 /// calendar as an array of integers.
90 public override int[] Eras
{
92 return new int[] { HebrewEra }
;
96 int twoDigitYearMax
= 5790;
98 public override int TwoDigitYearMax
101 return twoDigitYearMax
;
104 M_ArgumentInRange ("value", value, 100, M_MaxYear
);
106 twoDigitYearMax
= value;
111 /// A protected member checking a
112 /// <see cref="T:System.DateTime"/> value.
114 /// <param name="time">The
115 /// <see cref="T:System.DateTime"/>
118 /// <exception cref="T:System.ArgumentOutOfRangeException">
119 /// The exception is thrown if the
120 /// <see cref="T:System.DateTime"/> parameter is not in the years
121 /// between 5343 A.M. and 6000 A.M., inclusive.
123 internal void M_CheckDateTime(DateTime time
) {
124 if (time
.Ticks
< M_MinTicks
|| time
.Ticks
> M_MaxTicks
)
125 throw new ArgumentOutOfRangeException(
127 "Only hebrew years between 5343 and 6000," +
128 " inclusive, are supported.");
132 /// A protected method checking the era number.
134 /// <param name="era">The era number.</param>
135 /// <exception name="T:System.ArgumentException">
136 /// The exception is thrown if the era is not equal
137 /// <see cref="F:HebrewEra"/>.
139 internal void M_CheckEra(ref int era
) {
140 if (era
== CurrentEra
)
142 if (era
!= HebrewEra
)
143 throw new ArgumentException("Era value was not valid.");
147 /// A protected method checking calendar year and the era number.
149 /// <param name="year">An integer representing the calendar year.
151 /// <param name="era">The era number.</param>
152 /// <exception cref="T:System.ArgumentException">
153 /// The exception is thrown if the era is not equal
154 /// <see cref="F:HebrewEra"/>.
156 /// <exception cref="T:System.ArgumentOutOfRangeException">
157 /// The exception is thrown if the calendar year is outside of
158 /// the allowed range.
160 internal override void M_CheckYE(int year
, ref int era
) {
162 if (year
< M_MinYear
|| year
> M_MaxYear
)
163 throw new ArgumentOutOfRangeException(
165 "Only hebrew years between 5343 and 6000," +
166 " inclusive, are supported.");
170 /// A protected method checking the calendar year, month, and
173 /// <param name="year">An integer representing the calendar year.
175 /// <param name="month">An integer giving the calendar month.
177 /// <param name="era">The era number.</param>
178 /// <exception cref="T:System.ArgumentException">
179 /// The exception is thrown if the era is not equal
180 /// <see cref="F:HebrewEra"/>.
182 /// <exception cref="T:System.ArgumentOutOfRangeException">
183 /// The exception is thrown if the calendar year or month is
184 /// outside of the allowed range.
186 internal void M_CheckYME(int year
, int month
, ref int era
) {
187 M_CheckYE(year
, ref era
);
188 int l
= CCHebrewCalendar
.last_month_of_year(year
);
189 if (month
< 1 || month
> l
) {
190 StringWriter sw
= new StringWriter();
191 sw
.Write("Month must be between 1 and {0}.", l
);
192 throw new ArgumentOutOfRangeException("month",
198 /// A protected method checking the calendar day, month, and year
199 /// and the era number.
201 /// <param name="year">An integer representing the calendar year.
203 /// <param name="month">An integer giving the calendar month.
205 /// <param name="day">An integer giving the calendar day.
207 /// <param name="era">The era number.</param>
208 /// <exception cref="T:System.ArgumentException">
209 /// The exception is thrown if the era is not equal
210 /// <see cref="F:HebrewEra"/>.
212 /// <exception cref="T:System.ArgumentOutOfRangeException">
213 /// The exception is thrown if the calendar year, month, or day is
214 /// outside of the allowed range.
216 internal void M_CheckYMDE(int year
, int month
, int day
,
219 M_CheckYME(year
, month
, ref era
);
220 M_ArgumentInRange("day", day
, 1, GetDaysInMonth(year
, month
,
226 // The following routines are commented out as they do not appear on the .NET Framework 1.1
230 /// Overridden. Adds days to a given date.
232 /// <param name="time">The
233 /// <see cref="T:System.DateTime"/> to which to add
236 /// <param name="days">The number of days to add.</param>
237 /// <returns>A new <see cref="T:System.DateTime"/> value, that
238 /// results from adding <paramref name="days"/> to the specified
239 /// DateTime.</returns>
240 /// <exception cref="T:System.ArgumentOutOfRangeException">
241 /// The exception is thrown if the
242 /// <see cref="T:System.DateTime"/> return value is not in the years
243 /// between 5343 A.M. and 6000 A.M., inclusive.
245 public override DateTime
AddDays(DateTime time
, int days
) {
246 DateTime t
= base.AddDays(time
, days
);
252 /// Overridden. Adds hours to a given date.
254 /// <param name="time">The
255 /// <see cref="T:System.DateTime"/> to which to add
258 /// <param name="hours">The number of hours to add.</param>
259 /// <returns>A new <see cref="T:System.DateTime"/> value, that
260 /// results from adding <paramref name="hours"/> to the specified
261 /// DateTime.</returns>
262 /// <exception cref="T:System.ArgumentOutOfRangeException">
263 /// The exception is thrown if the
264 /// <see cref="T:System.DateTime"/> return value is not in the years
265 /// between 5343 A.M. and 6000 A.M., inclusive.
267 public override DateTime
AddHours(DateTime time
, int hours
) {
268 DateTime t
= base.AddHours(time
, hours
);
274 /// Overridden. Adds milliseconds to a given date.
276 /// <param name="time">The
277 /// <see cref="T:System.DateTime"/> to which to add
280 /// <param name="milliseconds">The number of milliseconds given as
281 /// double to add. Keep in mind the 100 nanosecond resolution of
282 /// <see cref="T:System.DateTime"/>.
284 /// <returns>A new <see cref="T:System.DateTime"/> value, that
285 /// results from adding <paramref name="milliseconds"/> to the specified
286 /// DateTime.</returns>
287 /// <exception cref="T:System.ArgumentOutOfRangeException">
288 /// The exception is thrown if the
289 /// <see cref="T:System.DateTime"/> return value is not in the years
290 /// between 5343 A.M. and 6000 A.M., inclusive.
292 public override DateTime
AddMilliseconds(DateTime time
,
295 DateTime t
= base.AddMilliseconds(time
, milliseconds
);
301 /// Overridden. Adds minutes to a given date.
303 /// <param name="time">The
304 /// <see cref="T:System.DateTime"/> to which to add
307 /// <param name="minutes">The number of minutes to add.</param>
308 /// <returns>A new <see cref="T:System.DateTime"/> value, that
309 /// results from adding <paramref name="minutes"/> to the specified
310 /// DateTime.</returns>
311 /// <exception cref="T:System.ArgumentOutOfRangeException">
312 /// The exception is thrown if the
313 /// <see cref="T:System.DateTime"/> return value is not in the years
314 /// between 5343 A.M. and 6000 A.M., inclusive.
316 public override DateTime
AddMinutes(DateTime time
, int minutes
) {
317 DateTime t
= base.AddMinutes(time
, minutes
);
323 /// Overridden. Adds seconds to a given date.
325 /// <param name="time">The
326 /// <see cref="T:System.DateTime"/> to which to add
329 /// <param name="seconds">The number of seconds to add.</param>
330 /// <returns>A new <see cref="T:System.DateTime"/> value, that
331 /// results from adding <paramref name="seconds"/> to the specified
332 /// DateTime.</returns>
333 /// <exception cref="T:System.ArgumentOutOfRangeException">
334 /// The exception is thrown if the
335 /// <see cref="T:System.DateTime"/> return value is not in the years
336 /// between 5343 A.M. and 6000 A.M., inclusive.
338 public override DateTime
AddSeconds(DateTime time
, int seconds
) {
339 DateTime t
= base.AddSeconds(time
, seconds
);
345 /// Overridden. Adds weeks to a given date.
347 /// <param name="time">The
348 /// <see cref="T:System.DateTime"/> to which to add
351 /// <param name="weeks">The number of weeks to add.</param>
352 /// <returns>A new <see cref="T:System.DateTime"/> value, that
353 /// results from adding <paramref name="weeks"/> to the specified
354 /// DateTime.</returns>
355 /// <exception cref="T:System.ArgumentOutOfRangeException">
356 /// The exception is thrown if the
357 /// <see cref="T:System.DateTime"/> return value is not in the years
358 /// between 5343 A.M. and 6000 A.M., inclusive.
360 public override DateTime
AddWeeks(DateTime time
, int weeks
) {
361 DateTime t
= base.AddWeeks(time
, weeks
);
367 /// Overridden. Gives the hour of the specified time.
369 /// <param name="time">The
370 /// <see cref="T:System.DateTime"/> that specifies the
373 /// <returns>An integer that gives the hour of the specified time,
374 /// starting with 0.</returns>
375 /// <exception cref="T:System.ArgumentOutOfRangeException">
376 /// The exception is thrown if the
377 /// <see cref="T:System.DateTime"/> parameter is not in the years
378 /// between 5343 A.M. and 6000 A.M., inclusive.
380 public override int GetHour(DateTime time
) {
381 M_CheckDateTime(time
);
382 return base.GetHour(time
);
386 /// Overridden. Gives the milliseconds in the current second
387 /// of the specified time.
389 /// <param name="time">The
390 /// <see cref="T:System.DateTime"/> that specifies the
393 /// <returns>An integer that gives the milliseconds in the seconds
394 /// of the specified time, starting with 0.</returns>
395 /// <exception cref="T:System.ArgumentOutOfRangeException">
396 /// The exception is thrown if the
397 /// <see cref="T:System.DateTime"/> parameter is not in the years
398 /// between 5343 A.M. and 6000 A.M., inclusive.
400 public override double GetMilliseconds(DateTime time
) {
401 M_CheckDateTime(time
);
402 return base.GetMilliseconds(time
);
406 /// Overridden. Gives the minute of the specified time.
408 /// <param name="time">The
409 /// <see cref="T:System.DateTime"/> that specifies the
412 /// <returns>An integer that gives the minute of the specified time,
413 /// starting with 0.</returns>
414 /// <exception cref="T:System.ArgumentOutOfRangeException">
415 /// The exception is thrown if the
416 /// <see cref="T:System.DateTime"/> parameter is not in the years
417 /// between 5343 A.M. and 6000 A.M., inclusive.
419 public override int GetMinute(DateTime time
) {
420 M_CheckDateTime(time
);
421 return base.GetMinute(time
);
425 /// Overridden. Gives the second of the specified time.
427 /// <param name="time">The
428 /// <see cref="T:System.DateTime"/> that specifies the
431 /// <returns>An integer that gives the second of the specified time,
432 /// starting with 0.</returns>
433 /// <exception cref="T:System.ArgumentOutOfRangeException">
434 /// The exception is thrown if the
435 /// <see cref="T:System.DateTime"/> parameter is not in the years
436 /// between 5343 A.M. and 6000 A.M., inclusive.
438 public override int GetSecond(DateTime time
) {
439 M_CheckDateTime(time
);
440 return base.GetMinute(time
);
445 /// Overrideden. Adds months to a given date.
447 /// <param name="time">The
448 /// <see cref="T:System.DateTime"/> to which to add
451 /// <param name="months">The number of months to add.</param>
452 /// <returns>A new <see cref="T:System.DateTime"/> value, that
453 /// results from adding <paramref name="months"/> to the specified
454 /// DateTime.</returns>
455 /// <exception cref="T:System.ArgumentOutOfRangeException">
456 /// The exception is thrown if the
457 /// <see cref="T:System.DateTime"/> return value is not in the years
458 /// between 5343 A.M. and 6000 A.M., inclusive.
460 public override DateTime
AddMonths(DateTime time
, int months
) {
467 int rd
= CCFixed
.FromDateTime(time
);
468 CCHebrewCalendar
.dmy_from_fixed(
469 out d
, out m
, out y
, rd
);
479 m
= GetMonthsInYear(y
);
485 int my
= GetMonthsInYear(y
);
486 if (m
+months
<= my
) {
496 t
= ToDateTime(y
, m
, d
, 0, 0, 0, 0);
497 t
= t
.Add(time
.TimeOfDay
);
504 /// Overridden. Adds years to a given date.
506 /// <param name="time">The
507 /// <see cref="T:System.DateTime"/> to which to add
510 /// <param name="years">The number of years to add.</param>
511 /// <returns>A new <see cref="T:System.DateTime"/> value, that
512 /// results from adding <paramref name="years"/> to the specified
513 /// DateTime.</returns>
514 /// <exception cref="T:System.ArgumentOutOfRangeException">
515 /// The exception is thrown if the
516 /// <see cref="T:System.DateTime"/> return value is not in the years
517 /// between 5343 A.M. and 6000 A.M., inclusive.
519 public override DateTime
AddYears(DateTime time
, int years
) {
520 int rd
= CCFixed
.FromDateTime(time
);
521 int day
, month
, year
;
522 CCHebrewCalendar
.dmy_from_fixed(
523 out day
, out month
, out year
, rd
);
525 rd
= CCHebrewCalendar
.fixed_from_dmy(day
, month
, year
);
526 DateTime t
= CCFixed
.ToDateTime(rd
);
527 t
= t
.Add(time
.TimeOfDay
);
533 /// Overriden. Gets the day of the month from
534 /// <paramref name="time"/>.
536 /// <param name="time">The
537 /// <see cref="T:System.DateTime"/> that specifies a
540 /// <returns>An integer giving the day of months, starting with 1.
542 /// <exception cref="T:System.ArgumentOutOfRangeException">
543 /// The exception is thrown if the
544 /// <see cref="T:System.DateTime"/> parameter is not in the years
545 /// between 5343 A.M. and 6000 A.M., inclusive.
547 public override int GetDayOfMonth(DateTime time
) {
548 M_CheckDateTime(time
);
549 int rd
= CCFixed
.FromDateTime(time
);
550 return CCHebrewCalendar
.day_from_fixed(rd
);
554 /// Overriden. Gets the day of the week from the specified date.
556 /// <param name="time">The
557 /// <see cref="T:System.DateTime"/> that specifies a
560 /// <returns>An integer giving the day of months, starting with 1.
562 /// <exception cref="T:System.ArgumentOutOfRangeException">
563 /// The exception is thrown if the
564 /// <see cref="T:System.DateTime"/> parameter is not in the years
565 /// between 5343 A.M. and 6000 A.M., inclusive.
567 public override DayOfWeek
GetDayOfWeek(DateTime time
) {
568 M_CheckDateTime(time
);
569 int rd
= CCFixed
.FromDateTime(time
);
570 return (DayOfWeek
)CCFixed
.day_of_week(rd
);
574 /// Overridden. Gives the number of the day in the year.
576 /// <param name="time">The
577 /// <see cref="T:System.DateTime"/> that specifies a
580 /// <returns>An integer representing the day of the year,
581 /// starting with 1.</returns>
582 /// <exception cref="T:System.ArgumentOutOfRangeException">
583 /// The exception is thrown if the
584 /// <see cref="T:System.DateTime"/> parameter is not in the years
585 /// between 5343 A.M. and 6000 A.M., inclusive.
587 public override int GetDayOfYear(DateTime time
) {
588 M_CheckDateTime(time
);
589 int rd
= CCFixed
.FromDateTime(time
);
590 int year
= CCHebrewCalendar
.year_from_fixed(rd
);
591 int rd1_7
= CCHebrewCalendar
.fixed_from_dmy(1, 7, year
);
592 return rd
- rd1_7
+ 1;
596 /// The method maps a .NET Hebrew month to a Calencdrical
597 /// Calculations Hebrew month.
599 /// <param name="month">An integer representing a month in .NET
600 /// counting (starting with Tishri).
602 /// <param name="year">An integer representing the Hebrew year.
604 /// <returns>The Hebrew month in Calendrical Calculations counting,
605 /// staring with the Hebrew month Nisan.
609 /// In .NET the month counting starts with the Hebrew month Tishri.
610 /// Calendrical Calculations starts with the month Tisan. So we must
614 internal int M_CCMonth(int month
, int year
) {
619 int l
= CCHebrewCalendar
.last_month_of_year(year
);
624 return month
<= 7 ? 6+month
: month
-7;
630 /// The method maps a Calendrical Calculations Hebrew month
631 /// to a .NET Hebrew month.
633 /// <param name="ccmonth">An integer representing a month in
634 /// Calendrical Calculations counting, starting with Nisan.
636 /// <param name="year">An integer representing the Hebrew year.
638 /// <returns>The Hebrew month in .NET counting,
639 /// staring with the Hebrew month Tishri.
643 /// In .NET the month counting starts with the Hebrew month Tishri.
644 /// Calendrical Calculations starts with the month Tisan. So we must
648 internal int M_Month(int ccmonth
, int year
) {
652 int l
= CCHebrewCalendar
.last_month_of_year(year
);
653 return ccmonth
+ (l
== 12 ? 6 : 7);
658 /// Overridden. Gives the number of days in the specified month
659 /// of the given year and era.
661 /// <param name="year">An integer that gives the year.
663 /// <param name="month">An integer that gives the month, starting
665 /// <param name="era">An integer that gives the era of the specified
667 /// <returns>An integer that gives the number of days of the
668 /// specified month.</returns>
669 /// <exception cref="T:System.ArgumentOutOfRangeException">
670 /// The exception is thrown, if <paramref name="month"/>,
671 /// <paramref name="year"/> ,or <paramref name="era"/> is outside
672 /// the allowed range.
674 public override int GetDaysInMonth(int year
, int month
, int era
) {
675 M_CheckYME(year
, month
, ref era
);
676 int ccmonth
= M_CCMonth(month
, year
);
677 int rd1
= CCHebrewCalendar
.fixed_from_dmy(1, ccmonth
, year
);
678 int rd2
= CCHebrewCalendar
.fixed_from_dmy(1, ccmonth
+1, year
);
683 /// Overridden. Gives the number of days of the specified
684 /// year of the given era.
686 /// <param name="year">An integer that specifies the year.
688 /// <param name="era">An ineger that specifies the era.
690 /// <returns>An integer that gives the number of days of the
691 /// specified year.</returns>
692 /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
693 /// The exception is thrown, if
694 /// <paramref name="year"/> or <paramref name="era"/> are outside the
697 public override int GetDaysInYear(int year
, int era
) {
698 M_CheckYE(year
, ref era
);
699 int rd1
= CCHebrewCalendar
.fixed_from_dmy(1, 7, year
);
700 int rd2
= CCHebrewCalendar
.fixed_from_dmy(1, 7, year
+1);
706 /// Overridden. Gives the era of the specified date.
708 /// <param name="time">The
709 /// <see cref="T:System.DateTime"/> that specifies a
712 /// <returns>An integer representing the era of the calendar.
714 /// <exception cref="T:System.ArgumentOutOfRangeException">
715 /// The exception is thrown if the
716 /// <see cref="T:System.DateTime"/> parameter is not in the years
717 /// between 5343 A.M. and 6000 A.M., inclusive.
719 public override int GetEra(DateTime time
) {
720 M_CheckDateTime(time
);
725 /// Overridden. Gives the number of the month of the specified
728 /// <param name="time">The
729 /// <see cref="T:System.DateTime"/> that specifies a
732 /// <returns>An integer representing the month,
733 /// starting with 1.</returns>
734 /// <exception cref="T:System.ArgumentOutOfRangeException">
735 /// The exception is thrown if the
736 /// <see cref="T:System.DateTime"/> parameter is not in the years
737 /// between 5343 A.M. and 6000 A.M., inclusive.
739 public override int GetMonth(DateTime time
) {
740 M_CheckDateTime(time
);
741 int rd
= CCFixed
.FromDateTime(time
);
743 CCHebrewCalendar
.my_from_fixed(out ccmonth
, out year
, rd
);
744 return M_Month(ccmonth
, year
);
748 /// Overridden. Gives the number of months in the specified year
751 /// <param name="year">An integer that specifies the year.
753 /// <param name="era">An integer that specifies the era.
755 /// <returns>An integer that gives the number of the months in the
756 /// specified year.</returns>
757 /// <exception cref="T:System.ArgumentOutOfRangeException">
758 /// The exception is thrown, if the year or the era are not valid.
760 public override int GetMonthsInYear(int year
, int era
) {
761 M_CheckYE(year
, ref era
);
762 return CCHebrewCalendar
.last_month_of_year(year
);
766 /// Overridden. Gives the number of the year of the specified
769 /// <param name="time">The
770 /// <see cref="T:System.DateTime"/> that specifies a
773 /// <returns>An integer representing the year,
774 /// starting with 1.</returns>
775 /// <exception cref="T:System.ArgumentOutOfRangeException">
776 /// The exception is thrown if the
777 /// <see cref="T:System.DateTime"/> parameter is not in the years
778 /// between 5343 A.M. and 6000 A.M., inclusive.
780 public override int GetYear(DateTime time
) {
781 M_CheckDateTime(time
);
782 int rd
= CCFixed
.FromDateTime(time
);
783 return CCHebrewCalendar
.year_from_fixed(rd
);
787 /// Overridden. Tells whether the given day
790 /// <param name="year">An integer that specifies the year in the
793 /// <param name="month">An integer that specifies the month.
795 /// <param name="day">An integer that specifies the day.
797 /// <param name="era">An integer that specifies the era.
799 /// <returns>A boolean that tells whether the given day is a leap
802 /// <exception cref="T:System.ArgumentOutOfRangeException">
803 /// The exception is thrown, if the year, month, day, or era is not
806 /// <remarks>All days in Adar II are viewed as leap days and the
807 /// last day of Adar I.
809 public override bool IsLeapDay(int year
, int month
, int day
, int era
)
811 M_CheckYMDE(year
, month
, day
, ref era
);
812 return IsLeapYear(year
) &&
813 (month
== 7 || (month
== 6 && day
== 30));
817 /// Overridden. Tells whether the given month
820 /// <param name="year">An integer that specifies the year in the
823 /// <param name="month">An integer that specifies the month.
825 /// <param name="era">An integer that specifies the era.
827 /// <returns>A boolean that tells whether the given month is a leap
830 /// <exception cref="T:System.ArgumentOutOfRangeException">
831 /// The exception is thrown, if the year, month, or era is not
835 /// Adar II is viewed as leap month.
837 public override bool IsLeapMonth(int year
, int month
, int era
) {
838 M_CheckYME(year
, month
, ref era
);
839 return IsLeapYear(year
) && month
== 7;
843 /// Overridden. Tells whether the given year
846 /// <param name="year">An integer that specifies the year in the
849 /// <param name="era">An integer that specifies the era.
851 /// <returns>A boolean that tells whether the given year is a leap
854 /// <exception cref="T:System.ArgumentOutOfRangeException">
855 /// The exception is thrown, if the year or era is not
858 public override bool IsLeapYear(int year
, int era
) {
859 M_CheckYE(year
, ref era
);
860 return CCHebrewCalendar
.is_leap_year(year
);
864 /// Overridden. Creates the
865 /// <see cref="T:System.DateTime"/> from the parameters.
867 /// <param name="year">An integer that gives the year in the
868 /// <paramref name="era"/>.
870 /// <param name="month">An integer that specifies the month.
872 /// <param name="day">An integer that specifies the day.
874 /// <param name="hour">An integer that specifies the hour.
876 /// <param name="minute">An integer that specifies the minute.
878 /// <param name="second">An integer that gives the second.
880 /// <param name="milliseconds">An integer that gives the
883 /// <param name="era">An integer that specifies the era.
886 /// <see cref="T:system.DateTime"/> representig the date and time.
888 /// <exception cref="T:System.ArgumentOutOfRangeException">
889 /// The exception is thrown, if at least one of the parameters
892 public override DateTime
ToDateTime(int year
, int month
, int day
,
893 int hour
, int minute
, int second
, int milliseconds
,
896 M_CheckYMDE(year
, month
, day
, ref era
);
897 M_CheckHMSM(hour
, minute
, second
, milliseconds
);
898 int ccm
= M_CCMonth(month
, year
);
899 int rd
= CCHebrewCalendar
.fixed_from_dmy(day
, ccm
, year
);
900 return CCFixed
.ToDateTime(rd
,
901 hour
, minute
, second
, milliseconds
);
905 public override int ToFourDigitYear (int year
)
907 throw new NotImplementedException ();
910 } // class HebrewCalendar
912 } // namespace System.Globalization