Convert 6 digit number to time in asp.net
Is there a function in .net that will take a number such as 134,501 and con开发者_StackOverflow社区vert it to time? That time would be 1:45:01 pm. I was hoping i didn't have to reinvent the wheel for this.
Assuming you're using today's date:
int timeNumber = 134501;
DateTime time = DateTime.ParseExact(timeNumber.ToString().PadLeft(6, '0'), "HHmmss", null);
精彩评论