Home » FAQ » ASP.NET » Basic » How to validate that a string is a valid date?
VB.NET
Dim blnValid As Boolean = False Try DateTime.Parse(MyString) blnValid = True Catch blnValid = False End Try
C#
bool blnValid=false; try { DateTime.Parse(MyString); blnValid=true; } catch { blnValid=false; }
Platform BlazorASP.NETWinFormsWPF.NET MAUI
Question *
Answer (Optional)
Email (Optional)
Email address is only for further clarification on your FAQ request. It will not be used for any other purpose.
Please leave this field empty.
Share with