DateTime格式轉換結果
阿新 • • 發佈:2017-09-21
orm clas ooad 格式 2017年 col line test log
Console.WriteLine(string.Format("ToLongDateString:{0}", DateTime.Now.ToLongDateString())); Console.WriteLine(string.Format("ToLongTimeString:{0}", DateTime.Now.ToLongTimeString())); Console.WriteLine(string.Format("ToOADate:{0}", DateTime.Now.ToOADate())); Console.WriteLine(string.Format("ToShortDateString:{0}", DateTime.Now.ToShortDateString())); Console.WriteLine(string.Format("ToShortTimeString:{0}", DateTime.Now.ToShortTimeString())); Console.WriteLine(string.Format("ToString:{0}", DateTime.Now.ToString())); Console.WriteLine(string.Format("ToString(\"yyyy - MM - dd HH:mm:ss.ffff\"):{0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff")));
運行結果:
ToLongDateString:2017年9月21日
ToLongTimeString:16:02:30
ToOADate:42999.6684130671
ToShortDateString:2017/9/21
ToShortTimeString:16:02
ToString:2017/9/21 16:02:30
ToString("yyyy - MM - dd HH:mm:ss.ffff"):2017-09-21 16:02:30.8921
DateTime格式轉換結果