//取得日期的星期別
private string Get_Weekday(string myDate)
{
 string myReturnValue = "";

 string [] myArray = new string [7] {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
 string [] myArray2 = new string [7] {"日","一","二","三","四","五","六"};

 int myIndex = Array.IndexOf(myArray, DateTime.Parse(myDate).DayOfWeek.ToString());
 myReturnValue = myArray2[myIndex];

 return myReturnValue;
}

//每個月有幾天(以兩位數表示)
DateTime.DaysInMonth(DateTime.Now.Year,DateTime.Now.Month).ToString("D2")
//下個月有幾天(以兩位數表示)
DateTime.DaysInMonth(DateTime.Now.Year,DateTime.Now.AddMonths(1).Month).ToString("D2")
//上個月有幾天(以兩位數表示)
DateTime.DaysInMonth(DateTime.Now.Year,DateTime.Now.AddMonths(-1).Month).ToString("D2")

welkingunther 發表在 痞客邦 PIXNET 留言(0) 人氣()