Convert string to date in C# / .NET Framework

access_time 2 years ago visibility37 comment 0

This code snippet shows how to convert string to date.

DateTime.Parse can be used to convert datetime string to DateTime type in C#/.NET.

Code snippet

var dateString="2017-10-15";
var date=DateTime.Parse(dateString);
Console.WriteLine(date);
Console.ReadLine();
info Last modified by Raymond at 6 days ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.


Learn more arrow_forward

More from Kontext

Get Started on Reunified .NET 5

local_offer .NET

visibility 8
thumb_up 0
access_time 5 days ago

In May 2019, Microsoft announced the roadmap for .NET in Build conference. .NET 5 is the update that unifies divergent frameworks, reduces code complexity and supports cross-platform reach including desktop, Web, mobile, cloud and device platforms. On 13th September 2020, Microsoft announced .NET ...

C# 9.0 New Features

local_offer C# local_offer .NET

visibility 29
thumb_up 0
access_time 5 days ago

.NET 5.0 release candidate 1 (rc.1) was published on 2020-09-14, which marks another big step towards the official .NET 5.0 release. As part of 5.0, C# 9.0 will be released with a bunch of new features. This article summarizes some of the new features with examples. Download .NET 5.0 SDK from this ...

Introduction to C# Interactive

local_offer C# local_offer .NET

visibility 91
thumb_up 0
access_time 5 days ago

Python, R and many other scripting languages generally support interactive programming features in their IDEs. When C# was created initially, all C# written programs need to be complied into MSIL first before it can run in .NET runtime environments (unless the code is dynamically complied).  ...

About column

Code snippets for various programming languages/frameworks.

rss_feed Subscribe RSS