System.Globalization.ThaiBuddhistCalendar.GetMonth C# (CSharp) Method

GetMonth() public method

public GetMonth ( System.DateTime time ) : int
time System.DateTime
return int
        public override int GetMonth(DateTime time) {
            return (helper.GetMonth(time));
        }

Usage Example

        public void PosTest1()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand = new Random(-55);
            int year = rand.Next(tbc.MinSupportedDateTime.Year, tbc.MaxSupportedDateTime.Year + 1);
            int month = rand.Next(1, 12);
            int day;
            if (IsLeapYear(year))
            {
                day = rand.Next(1, _DAYS_PER_MONTHS_IN_LEAP_YEAR[month] + 1);
            }
            else
            {
                day = rand.Next(1, _DAYS_PER_MONTHS_IN_NO_LEAP_YEAR[month] + 1);
            }

            DateTime dt = new DateTime(year, month, day);
            int actualMonth = dt.Month;
            Assert.Equal(actualMonth, tbc.GetMonth(dt));
        }
All Usage Examples Of System.Globalization.ThaiBuddhistCalendar::GetMonth