把hundred year表示的時間轉換成普通時間,當然也可以用ToOADate()得到該日期的hundred year時間 System.DateTime.FromOADate(double.Parse("41340")) {3/7/2013 12:00:00 AM}2.把字串轉換成datatimeDateTime dt = Convert.ToDateTime("8/23/2012");{1/1/0001 12:00:00 AM}3.一些時間格式的format,注意大寫M指月份,小寫m指分鐘string dateStr = DateTime.Today.ToString("yyyy MMMM", System.Globalization.DateTimeFormatInfo.InvariantInfo);"2013 April"DateTime.Today.ToString("dddd, dd MMMM yyyy HH:mm:ss")Sunday, 07 April 2013 00:00:00
DateTime.Today.ToString("ddd, dd MMM yyyy HH":"mm":"ss "GMT"")Sun, 07 Apr 2013 00:00:00 GMT
DateTime.Today.ToString("yyyyMMdd hhmmssfff")20130407 120000000DateTime.Now.ToString("yyyyMMdd hhmmssfff")20130407 041007557
把hundred year表示的時間轉換成普通時間,當然也可以用ToOADate()得到該日期的hundred year時間 System.DateTime.FromOADate(double.Parse("41340")) {3/7/2013 12:00:00 AM}2.把字串轉換成datatimeDateTime dt = Convert.ToDateTime("8/23/2012");{1/1/0001 12:00:00 AM}3.一些時間格式的format,注意大寫M指月份,小寫m指分鐘string dateStr = DateTime.Today.ToString("yyyy MMMM", System.Globalization.DateTimeFormatInfo.InvariantInfo);"2013 April"DateTime.Today.ToString("dddd, dd MMMM yyyy HH:mm:ss")Sunday, 07 April 2013 00:00:00
DateTime.Today.ToString("ddd, dd MMM yyyy HH":"mm":"ss "GMT"")Sun, 07 Apr 2013 00:00:00 GMT
DateTime.Today.ToString("yyyyMMdd hhmmssfff")20130407 120000000DateTime.Now.ToString("yyyyMMdd hhmmssfff")20130407 041007557