I need a string from datetime to display time in 24 hour format.
.. var curr = DateTime.Now; string s = ???; Console.WriteLine(s); ..
The output should be: "16:38" Thank you.
Use upper case HH for 24 hour format:
HH
String s = curr.ToString("HH:mm");
See the DateTime.ToString Method .
Console.WriteLine(curr.ToString("HH:mm"));