Converting time to Military

后端 未结 6 1245
清歌不尽
清歌不尽 2021-01-11 12:40

In an attempt to turn a date with a format of \"mm/dd/yyyy hh:mm:ss PM\" into military time, the following replacement of a row value does not seem to take. Eve

6条回答
  •  情话喂你
    2021-01-11 13:13

    Simple way is

    bool timeConversion = DateTime.TryParse(s,out DateTime time);
    
    if(timeConversion)
    {
    return time.Tostring("HH:mm:ss");
    }
    

    here be careful to write "HH"

提交回复
热议问题