Convert string to date in C# / .NET Framework

visibility 264 access_time 2 years ago languageEnglish

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.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

timeline Stats
Page index 0.24
More from Kontext
.NET 5 is Officially Released
visibility 72
thumb_up 0
access_time 2 years ago
.NET Hot Reload in Visual Studio Code
visibility 145
thumb_up 0
access_time 2 months ago