Convert string to Time

前端 未结 4 616
忘了有多久
忘了有多久 2021-02-01 13:23

I have a time that is 16:23:01. I tried using DateTime.ParseExact, but it\'s not working.

Here is my code:

string Time = \"16:23:01\"; 
Date         


        
4条回答
  •  遥遥无期
    2021-02-01 14:15

    string Time = "16:23:01";
    DateTime date = DateTime.Parse(Time, System.Globalization.CultureInfo.CurrentCulture);
    
    string t = date.ToString("HH:mm:ss tt");
    

提交回复
热议问题