美文网首页
DateTime时间格式转换大全

DateTime时间格式转换大全

作者: 北风知我意 | 来源:发表于2016-10-12 09:24 被阅读90次

    Datetime时间类型转换一览

    复制代码

               Console.WriteLine(DateTime.Now.ToString());

               Console.WriteLine(DateTime.Now.ToShortDateString());

               Console.WriteLine(DateTime.Now.ToShortTimeString());

               Console.WriteLine(DateTime.Now.ToLongDateString());

               Console.WriteLine(DateTime.Now.ToLongTimeString());

               Console.WriteLine(DateTime.Now.Date);

               Console.WriteLine(DateTime.Now.Day);

               Console.WriteLine(DateTime.Now.DayOfWeek);

               Console.WriteLine(DateTime.Now.DayOfYear);

               Console.WriteLine(DateTime.Now.GetDateTimeFormats());

               Console.WriteLine(DateTime.Now.Hour);

               Console.WriteLine(DateTime.Now.Minute);

               Console.WriteLine(DateTime.Now.Year);

               Console.WriteLine(DateTime.Now.Kind);

               Console.WriteLine(DateTime.Now.Millisecond);

               Console.WriteLine(DateTime.Now.TimeOfDay);

               Console.WriteLine(DateTime.Now.ToFileTime());

               Console.WriteLine(DateTime.Now.ToFileTimeUtc());

               Console.WriteLine(DateTime.Now.ToLocalTime());

               Console.WriteLine(DateTime.Now.ToOADate());

               Console.WriteLine(DateTime.Now.ToUniversalTime());

    复制代码

    结果:

    DateTime时间格式转换大全

       

    相关文章

      网友评论

          本文标题:DateTime时间格式转换大全

          本文链接:https://www.haomeiwen.com/subject/jgfiyttx.html