Home / Software / Tips and Tricks / How to convert to 'DateTime' without 'InvalidCastException.' exception?

How to convert to 'DateTime' without 'InvalidCastException.' exception?

Updated:  08/18/2014 17:08 PM
Author:  Shiju Mathews

Status:    Resolved.


use DateTime.TryParse Method (String, DateTime) method.

Converts the specified string representation of a date and time to its DateTime equivalent and returns a value that indicates whether the conversion succeeded.

Syntax: