Convert String to DateTime in C#

I have the following String:

20090408160428

How can I convert this to a regular DateTime. Is there any Method to do this, or do i have to get the different values (e.g. year) with the Substring methods and create my own formatted string

schubdueseAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
CebikConnect With a Mentor Commented:

DateTime data = DateTime.ParseExact("20090408160428", "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.