C# 日期格式

mac2022-06-30  25

DateTime d = DateTime.Now;            Response.Write("当前时间:" + d.ToString() + "<BR><BR>");            Response.Write("Date = " + d.Date.ToString() + "<BR>");            Response.Write("Day = " + d.Day.ToString() + "<BR>");            Response.Write("DayOfWeek = " + d.DayOfWeek.ToString() + "<BR>");            Response.Write("DayOfYear = " + d.DayOfYear.ToString() + "<BR>");            Response.Write("Hour = " + d.Hour.ToString() + "<BR>");            Response.Write("Millisecond = " + d.Millisecond.ToString() + "<BR>");            Response.Write("Minute = " + d.Minute.ToString() + "<BR>");            Response.Write("Month = " + d.Month.ToString() + "<BR>");            Response.Write("Second = " + d.Second.ToString() + "<BR>");            Response.Write("Ticks = " + d.Ticks.ToString() + "<BR>");            Response.Write("TimeOfDay = " + d.TimeOfDay.ToString() + "<BR>");            Response.Write("ToFileTime = " + d.ToFileTime().ToString() + "<BR>");            Response.Write("ToFileTimeUtc = " + d.ToFileTimeUtc().ToString() + "<BR>");            Response.Write("ToLocalTime = " + d.ToLocalTime().ToString() + "<BR>");            Response.Write("ToLongDateString = " + d.ToLongDateString() + "<BR>");            Response.Write("ToLongTimeString = " + d.ToLongTimeString() + "<BR>");            Response.Write("ToOADate = " + d.ToOADate().ToString() + "<BR>");            Response.Write("ToShortDateString = " + d.ToShortDateString() + "<BR>");            Response.Write("ToShortTimeString = " + d.ToShortTimeString() + "<BR>");            Response.Write("ToUniversalTime = " + d.ToUniversalTime() + "<BR>");

当前时间:2005-11-3 18:31:30Date = 2005-11-3 0:00:00Day = 3DayOfWeek = ThursdayDayOfYear = 307Hour = 18Millisecond = 171Minute = 31Month = 11Second = 30Ticks = 632666394901718750TimeOfDay = 18:31:30.1718750ToFileTime = 127754874901718750ToFileTimeUtc = 127755162901718750ToLocalTime = 2005-11-4 2:31:30ToLongDateString = 2005年11月3日ToLongTimeString = 18:31:30ToOADate = 38659.7718769792ToShortDateString = 2005-11-3ToShortTimeString = 18:31ToUniversalTime = 2005-11-3 10:31:30

转载于:https://www.cnblogs.com/webman/archive/2006/08/25/486244.html

相关资源:c#处理日期格式(全面)
最新回复(0)