Solved

Convert String to DateTime in C#

Posted on 2009-04-08
1
2,840 Views
Last Modified: 2013-12-17
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

0
Comment
Question by:schubduese
1 Comment
 
LVL 6

Accepted Solution

by:
Cebik earned 250 total points
ID: 24098023

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

Open in new window

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now