Convert string to date in C# / .NET Framework

visibility 278 access_time 2 years ago languageEnglish timeline Stats
timeline Stats
Page index 0.25
more_horiz

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 2 years 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

More from Kontext
EntityFramework Core - Update Only One Field
visibility 4,640
thumb_up 3
access_time 2 years ago
.NET 5 is Officially Released
visibility 77
thumb_up 0
access_time 2 years ago