DateTime.Parse examples

This sample code is a .NET Core console application written in C#. It presents numbered options to the user that correspond to different date and time parsing examples.

Sample prerequisites

This sample is written in C# and targets .NET Core 3.1. It requires the .NET Core 3.1 SDK.

Build the sample

The source code includes an MSBuild project file for C# (a .csproj file) that targets .NET Core 3.1. After you download the .zip file containing the example code, create a directory and select Download ZIP to download the sample code files to your computer.

To build the sample:

  1. Download the .zip file.
  2. Extrat the files in the .zip file to a directory of your choice.
  3. If you're using Visual Studio 2019:
    1. In Visual Studio, select Open a project or solution on the Start page. Or, select File > Open > Project/Solution from the top menu.
    2. Select Debug > Start Debugging from the top menu to build and launch the application.
  4. If you're working from the command line:
    1. Navigate to the directory that contains the sample.
    2. Enter the command dotnet run to build and launch the application.