Convert string to specific DateTime format

前端 未结 5 1554
既然无缘
既然无缘 2021-01-07 01:17

I\'ve been googling for a while now and for the life of me can\'t seem to find a solution. I thought this would be easy but it\'s taking too long and am turning to stackover

5条回答
  •  生来不讨喜
    2021-01-07 02:02

    Try this.

        DateTime dt;
        if (DateTime.TryParse(startTime, out dt))
        {
            string newDateTime = dt.ToString("MM/dd/yyyy hh:mmtt");
        }
    

提交回复
热议问题