Convert 6-digit time to asp.net

Is there a function in .net that will take a number like 134 501 and convert it in time? This time was 13:45:01. I was hoping that I did not need to reinvent the wheel for this.

+5
source share
1 answer

Assuming you are using today's date:

int timeNumber = 134501;
DateTime time = DateTime.ParseExact(timeNumber.ToString().PadLeft(6, '0'), "HHmmss", null);
+14
source

All Articles