Convert string to DateTime in c#

Viewed 24229

What is the easiest way to convert the following date created using

dateTime.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture)

into a proper DateTime object?

20090530123001

I have tried Convert.ToDateTime(...) but got a FormatException.

3 Answers
Related