Convert a string to a date in .net

后端 未结 6 1561
忘了有多久
忘了有多久 2020-12-10 15:21

I\'m reading text from a flat file in c# and need to test whether certain values are dates. They could be in either YYYYMMDD format or MM/DD/YY format. What is the simplest

6条回答
  •  不思量自难忘°
    2020-12-10 15:55

    Using TryParse will not throw an exception if it fails. Also, TryParse will return True/False, indicating the success of the conversion.

    Regards...

提交回复
热议问题