private List <ItemType> _lstBakDate; //备份showingDate,用于滚动 public czCalendarViewModel() { _isBlackTheme = false; _selectedDate = DateTime.Now; _calendarType = EDateType.Days; _lstDays = new List <ItemType>(); _lstMonth = new List <ItemType>(); _lstYear = new List <ItemType>(); }
/// <summary> /// Return the desired Date time. /// </summary> /// <param name="sInputDate">Format : dd-mm-yyyy</param> /// <param name="sType">"",From,To and MIN</param> /// <returns></returns> public static DateTime GetDate(string sInputDate, EDateType eDateType) { DateTime oNow = DateTime.Now; DateTime oDateTime = DateTime.MinValue; string[] sDate = sInputDate.Trim().Split('-'); string sHour = oNow.Hour.ToString(); string sMinute = oNow.Minute.ToString(); string sSecond = oNow.Second.ToString(); if (eDateType == EDateType.FROM) { sHour = "00"; sMinute = "00"; sSecond = "00"; } else if (eDateType == EDateType.TO) { sHour = "23"; sMinute = "59"; sSecond = "59"; } if (eDateType == EDateType.MIN) { oDateTime = new DateTime(1900, 01, 01, 00, 00, 00); } else { try { oDateTime = new DateTime(int.Parse(sDate[2]), int.Parse(sDate[1]), int.Parse(sDate[0]), int.Parse(sHour), int.Parse(sMinute), int.Parse(sSecond)); } catch (Exception) { oDateTime = DateTime.MinValue; } } return(oDateTime); }