Live Chat Icon For mobile
Live Chat Icon

How can I determine if a string is a valid date

Platform: WinForms| Category: Strings

You can use the static DateTime.Parse or DateTime.ParseExact and catch any exceptions.

	System.DateTime myDateTime;
	bool isValid = true;
	try 
	{
    		myDateTime = System.DateTime.Parse(strMyDateTime);
	} 
	catch (Exception e) 
	{
    		isValid = false;
	}

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.