Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 26th, 2012  |  syntax: None  |  size: 0.23 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. c# DateTime need to show only Time
  2. ToShortTimeString()
  3.        
  4. DateTime Time = DateTime.Now;
  5. Time.ToString("h tt");
  6.        
  7. DateTime date= new DateTime(2008, 4, 1, 18, 53, 0);
  8. Console.WriteLine(date.ToString("h tt"));  // Displays 6 PM