0
How to make a program which takes input of time in 12 hrs and converts in 24hrs
the input should be like 05:44:23PM output 17:44:23
3 Antworten
+ 4
Console.WriteLine(DateTime.Parse("05:44:23PM").ToString("HH:mm:ss"));
+ 1
if its PM , add 12 in hours part and for AM leave as it is
+ 1
Be careful with 12h, though! 12am is 0h, and 12pm is 12h... There's no need to add 12 in these cases.