string not recognized as valid datetime with same format

前端 未结 2 720
温柔的废话
温柔的废话 2021-01-24 23:13

I have this string: 02/01/2019 13:00:00 I want get only the 02/01/2019, so I did:

var date = DateTime.ParseExact(match.datetime.ToString(), \"dd/MM/         


        
2条回答
  •  爱一瞬间的悲伤
    2021-01-24 23:32

    The problem is that in your format ("dd/MM/yyyy hh:mm:ss") you're specifying a 12-hour representation with "hh", but you're input is outside of that range: "13:00:00".

提交回复
热议问题