有关DateTime的几个格式.

  
  
  
  
  1. Console.WriteLine("DateTime.Today:\t"+DateTime.Today.ToString()); 
  2. Console.WriteLine("DateTime.Now:\t"+DateTime.Now.ToString()); 
  3. Console.WriteLine("DateTime.UtcNow:\t" + DateTime.UtcNow.ToString()); 
  4. Console.WriteLine("new DateTime():\t"+new DateTime().ToString()); 
  5. Console.WriteLine("new DateTime().ToLocalTime():\t" + new DateTime().ToLocalTime().ToString()); 
  6. Console.WriteLine("new DateTime().ToShortDateString():\t"+new DateTime().ToShortDateString()); 
  7. Console.WriteLine("new DateTime().ToShortTimeString():\t"+new DateTime().ToShortTimeString()); 
  8. Console.WriteLine("new DateTime().ToLongDateString():\t" + new DateTime().ToLongDateString()); 
  9. Console.WriteLine("new DateTime().ToLongTimeString():\t"+new DateTime().ToLongTimeString()); 
  10. Console.WriteLine("new DateTime().ToUniversalTime():\t" + new DateTime().ToUniversalTime().ToString()); 

你可能感兴趣的:(C#,职场,DateTime,休闲)