System.Globalization.HijriCalendar.GetDayOfMonth C# (CSharp) Method

GetDayOfMonth() public method

public GetDayOfMonth ( DateTime time ) : int
time DateTime
return int
        public override int GetDayOfMonth(DateTime time) {
            return (GetDatePart(time.Ticks, DatePartDay));
        }

Usage Example

Example #1
0
        public static bool IsHolyDay(DateTime mydate)
        {
            PersianCalendar PersianCalEvents = new PersianCalendar();
            HijriCalendar HijriCalEvents = new HijriCalendar();

            var PerDay = PersianCalEvents.GetDayOfMonth(mydate);
            var HijDay = HijriCalEvents.GetDayOfMonth(CalendarClass.Yesterday(mydate));

            var PerMonth = PersianCalEvents.GetMonth(mydate);
            var HijMonth = HijriCalEvents.GetMonth(CalendarClass.Yesterday(mydate));

            switch (PerMonth)
            {
                case 1:
                    switch (PerDay)
                    {
                        case 1: return true;
                        case 2: return true;
                        case 3: return true;
                        case 4: return true;
                        case 12: return true;
                        case 13: return true;
                    }
                    break;
                case 3:
                    switch (PerDay)
                    {
                        case 14: return true;
                        case 15: return true;
                    }
                    break;
                case 11:
                    switch (PerDay)
                    {
                        case 22: return true;
                    }
                    break;
                case 12:
                    switch (PerDay)
                    {
                        case 29: return true;
                    }
                    break;
            }

            switch (HijMonth)
            {
                case 1:
                    switch (HijDay)
                    {
                        case 9: return true;
                        case 10: return true;
                    }
                    break;
                case 2:
                    switch (HijDay)
                    {
                        case 20: return true;
                        case 28: return true;
                        case 30: return true;
                    }
                    break;
                case 3:
                    switch (HijDay)
                    {
                        case 17: return true;
                    }
                    break;
                case 6:
                    switch (HijDay)
                    {
                        case 3: return true;
                    }
                    break;
                case 7:
                    switch (HijDay)
                    {
                        case 13: return true;
                        case 27: return true;
                    }
                    break;
                case 8:
                    switch (HijDay)
                    {
                        case 15: return true;
                    }
                    break;
                case 9:
                    switch (HijDay)
                    {
                        case 21: return true;
                    }
                    break;
                case 10:
                    switch (HijDay)
                    {
                        case 1: return true;
                        case 2: return true;
                        case 25: return true;
                    }
                    break;
                case 12:
                    switch (HijDay)
                    {
                        case 10: return true;
                        case 18: return true;
                    }
                    break;

            }

            return false;
        }
All Usage Examples Of System.Globalization.HijriCalendar::GetDayOfMonth