Skip to content

Date validation

paddylast

Asked Oct 15, 2004, 5:20 AM EDT1 answer
Share
LinkedInX
I have a win form with a textfield for a date and a validation button with: myDate = txtDate.Text; I want to validate this as a valid date in my code rather that on the client. Is there an easy way to do this? Thanks.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Take a look at the System.DateTime class. You can use DateTime.Parse() to convert a string to a DateTime object. be carefull how you format the string though. Also look here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimememberstopic.asp
    0