开发者

Convert 6 digit number to time in asp.net

开发者 https://www.devze.com 2023-02-03 23:33 出处:网络
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

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消