/// <summary> /// Creates A MonthAYear Group Using A Forward-Slash Date Formatted String. Example: 01/01/2021. /// Could Also Try Using Standard Date Format. Example: January 1st, 2021. /// </summary> /// <param name="_date"></param> /// <returns></returns> public MyMonthAYearGroupUtility(string _date) { var _dateByMonthAndYear = CalculateDateByMonthAndYear(_date); this.DateByMonth = _dateByMonthAndYear.dateByMonth; this.DateByYear = _dateByMonthAndYear.dateByYear; this.DateByDay = _dateByMonthAndYear.dateByDay; }
public static int GetDayCountFromMonthAYear(EDateByMonth _month, EDateByYear _year) { switch (_month) { case EDateByMonth.Undecided: return(-1); case EDateByMonth.January: return(31); case EDateByMonth.February: if (_year == EDateByYear.Y2020 || _year == EDateByYear.Y2024) { return(29); } return(28); case EDateByMonth.March: return(31); case EDateByMonth.April: return(30); case EDateByMonth.May: return(31); case EDateByMonth.June: return(30); case EDateByMonth.July: return(31); case EDateByMonth.August: return(31); case EDateByMonth.September: return(30); case EDateByMonth.October: return(31); case EDateByMonth.November: return(30); case EDateByMonth.December: return(31); default: return(-1); } }
public static bool IsMonthMissingDays(EDateByMonth _month, EDateByYear _year, int _dayCount) { return(_dayCount != GetDayCountFromMonthAYear(_month, _year)); }
private MyMonthAYearGroupUtility() { this.DateByMonth = EDateByMonth.Undecided; this.DateByYear = EDateByYear.Undecided; }