Set DateTime format

后端 未结 6 1251
萌比男神i
萌比男神i 2020-12-03 22:44

I have the following code -

DateTime timeStamp;

timeStamp = System.Convert.ToDateTime(y.InnerText);

Where y.InnerText is

6条回答
  •  鱼传尺愫
    2020-12-03 22:53

    I use this step 1. Convert to DateTime. 2. Use ToString(); function

    Example :

     DateTime myDateTime = DateTime.Now;
     string myDateTimeString = myDateTime.ToString("yyyy-mm-dd hh:mm:ss");
    

提交回复
热议问题