Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Convert String to DateTime in C#

Posted on 2009-04-08
1
Medium Priority
?
2,855 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 1000 total points
ID: 24098023

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

Open in new window

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

885 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