From the course: C# and .NET Essential Training
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Formatting dates and times - C# Tutorial
From the course: C# and .NET Essential Training
Formatting dates and times
- [Instructor] Just as we saw with numerical data earlier, there are plenty of ways to format date and time information. In this example, we'll see how to use .NET formatting strings to control how dates and times are formatted. The .NET documentation at this link describes the various ways that dates and times can be formatted. And I'll return to this in a moment. First, I want to just give a brief demonstration of how formatting works. So let's jump over to VS Code. And what I'm going to do is open up in my Format Dates folder the program. So here in my program code, I have a date-time that represents April Fool's Day. So let's try a couple of different ways to format the date. Now there's a couple of different ways to do this. For simplicity, I'm just going to use the same string interpolation technique that I've been using during the course. So let's try both the short and full date formats. So I'm going…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.