Converting a String to DateTime

后端 未结 17 2613
南方客
南方客 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:30

    Try the below, where strDate is your date in 'MM/dd/yyyy' format

    var date = DateTime.Parse(strDate,new CultureInfo("en-US", true))
    

提交回复
热议问题