Convert string to date in C# / .NET Framework

access_time 2 years ago visibility65 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 2 months 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

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to publish your article on Kontext?

Learn more

More from Kontext

visibility 1606
thumb_up 0
access_time 5 months ago

Microsoft 365 and Office 365 supports using licensed user account to send emails in client applications. SMTP protocol can be used to send emails in ASP.NET Core applications. This article shows how to use SMTP AUTH to send emails in ASP.NET Core 3.1 applications. warning  This guide is ...

Run .NET 5 on Azure App Services
visibility 161
thumb_up 0
access_time 4 months ago

.NET 5 RC2 was released on 2020-10-13. On Azure, you can only select .NET Core 3.1 or 2.1 LTS versions as runtime stack when creating web app as the following screenshot shows.   This will stay as is till .NET 5 official release. However, you can use extensions to run your .NET 5 ...

visibility 27
thumb_up 0
access_time 3 months ago

Kontext platform is now upgraded to the latest .NET 5 from .NET 5 preview versions as at 2020-11-12. The upgrades include: ASP.NET Core Projects: from ASP.NET Core 5 preview extensions to .NET 5 built-in stack. Azure DevOps Build Pipeline Azure App Services Regards, Kontext Admin