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

结果:

posted @ 2013-02-19 20:38  瓜王  阅读(5008)  评论(0编辑  收藏  举报