C# 日期格式


C# 日期格式


日期显示格式:

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

 

            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>");

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值