DateTime Toxxx() 方法获取时间

直接上代码

 static void Main(string[] args)
        {
            DateTime time = DateTime.Now;
            Console.WriteLine("ToFileTime:"+time.ToFileTime());
            Console.WriteLine("ToLocalTime:"+time.ToLocalTime());
            Console.WriteLine("ToLongDateString:"+time.ToLongDateString());
            Console.WriteLine("ToLongTimeString:"+time.ToLongTimeString());
            Console.WriteLine("ToOADate:"+time.ToOADate());
            Console.WriteLine("ToShortDateString:"+time.ToShortDateString());
            Console.WriteLine("ToShortTimeString:"+time.ToShortTimeString());
            Console.WriteLine("ToString:"+time.ToString());
            Console.ReadLine();
        }

 

 

结果:

ToFileTime:131432281146049537
ToLocalTime:2017/6/30 0:41:54
ToLongDateString:2017年6月30日
ToLongTimeString:0:41:54
ToOADate:42916.029104213
ToShortDateString:2017/6/30
ToShortTimeString:0:41
ToString:2017/6/30 0:41:54

 

 

想要哪个取哪个

posted @ 2017-06-30 00:36  站在走廊弹吉他  阅读(403)  评论(0编辑  收藏  举报