How do you get the current time (not date AND time)?
Example: 5:42:12 PM
This will be better, Try This one
DateTime.Now.ToShortTimeString();
For this you don't need to specify the Format for the Time.
Another option using String.Format()
string.Format("{0:HH:mm:ss tt}", DateTime.Now)
var CurDate= DateTime.Now;
CurDate.Hour;
CurDate.Minute;
CurDate.Millisecond
Here we go:
DateTime time = DateTime.Now;
Console.WriteLine(time.ToString("h:mm:ss tt"));
To calculate the current datetime:
DateTime theDate = DateTime.UtcNow;
string custom = theDate.ToString("d");
MessageBox.Show(custom);
very simple DateTime.Now.ToString("hh:mm:ss tt")