C# 日期格式

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:30

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

posted on 2006-08-25 15:03  hzman  阅读(325)  评论(0编辑  收藏  举报