Best way to get a date with .NET?

前端 未结 4 1762
太阳男子
太阳男子 2021-02-20 07:56

I\'m getting a string back from my page and I want to make sure it\'s a date. This is what I have so far (it works) and I just want to know if this is the \"best\" way to do it.

4条回答
  •  终归单人心
    2021-02-20 08:05

    How about DateTime.TryParse and DateTime.TryParseExact?

    The first one uses the current cultures date format.

提交回复
热议问题