Best way to get a date with .NET?

前端 未结 4 1693
太阳男子
太阳男子 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:13

    .NET gives us a datetime.parse

    http://msdn.microsoft.com/en-us/library/1k1skd40.aspx

    and a datetime.tryparse

    http://msdn.microsoft.com/en-us/library/ch92fbc1.aspx

    which both are a good way to parse dates from strings

提交回复
热议问题