Solved

Convert String to DateTime in C#

Posted on 2009-04-08
1
2,842 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# bracket error 3 31
C# Desktop Application 3 35
start a process from a service 3 23
Get number of Files in Directory and Sub Directories 2 42
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

810 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