Converting a String to DateTime

后端 未结 17 2576
南方客
南方客 2020-11-21 06:12

How do you convert a string such as 2009-05-08 14:40:52,531 into a DateTime?

17条回答
  •  野的像风
    2020-11-21 06:49

    String now = DateTime.Now.ToString("YYYY-MM-DD HH:MI:SS");//make it datetime
    DateTime.Parse(now);
    

    this one gives you

    2019-08-17 11:14:49.000
    

提交回复
热议问题