日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > C# >内容正文

C#

C# 时间日期

發(fā)布時間:2025/4/14 C# 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C# 时间日期 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1: using System; // 包括所有的date/time 2: 3: class testDateTime 4: { 5: public static void Main() 6: { 7: DateTime CurrTime = DateTime.Now; 8: 9: Console.WriteLine("DateTime display listing specifier and result:\n"); 10: 11: Console.WriteLine("d = {0:d}", CurrTime ); // Short date mm/dd/yyyy 12: Console.WriteLine("D = {0:D}", CurrTime ); // Long date day, month dd, yyyy 13: Console.WriteLine("f = {0:f}", CurrTime ); // Full date/short time day, month dd, yyyy hh:mm 14: Console.WriteLine("F = {0:F}", CurrTime ); // Full date/full time day, month dd, yyyy HH:mm:ss AM/PM 15: Console.WriteLine("g = {0:g}", CurrTime ); // Short date/short time mm/dd/yyyy HH:mm 16: Console.WriteLine("G = {0:G}", CurrTime ); // Short date/long time mm/dd/yyyy hh:mm:ss 17: Console.WriteLine("M = {0:M}", CurrTime ); // Month dd 18: Console.WriteLine("R = {0:R}", CurrTime ); // ddd Month yyyy hh:mm:ss GMT 19: Console.WriteLine("s = {0:s}", CurrTime ); // yyyy-mm-dd hh:mm:ss can be sorted! 20: Console.WriteLine("t = {0:t}", CurrTime ); // Short time hh:mm AM/PM 21: Console.WriteLine("T = {0:T}", CurrTime ); // Long time hh:mm:ss AM/PM 22: Console.WriteLine("u = {0:u}", CurrTime ); // yyyy-mm-dd hh:mm:ss universal/sortable 23: Console.WriteLine("U = {0:U}", CurrTime ); // day, month dd, yyyy hh:mm:ss AM/PM 24: Console.WriteLine("Y = {0:Y}", CurrTime ); // Month, yyyy 25: Console.WriteLine(); 26: Console.WriteLine("DateTime.Month = " + CurrTime.Month); // number of month 27: Console.WriteLine("DateTime.DayOfWeek = " + CurrTime.DayOfWeek); // full name of day 28: Console.WriteLine("DateTime.TimeOfDay = " + CurrTime.TimeOfDay); // 24 hour time 29: 30: // number of 100-nanosecond intervals that have elapsed since 1/1/0001, 12:00am 31: // useful for time-elapsed measurements 32: Console.WriteLine("DateTime.Ticks = " + CurrTime.Ticks); 33: 34: Console.Read(); // wait 35: } 36: }

轉(zhuǎn)載于:https://www.cnblogs.com/tannaiyin/archive/2009/12/23/1630211.html

總結(jié)

以上是生活随笔為你收集整理的C# 时间日期的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。