Articles → CSHARP → Dateonly And The Timeonly Struct In C#
Dateonly And The Timeonly Struct In C#
Purpose
Example
var dateOnly = new DateOnly(2022, 1, 1);
Console.WriteLine("Output of DateOnly is:");
Console.WriteLine(dateOnly.ToString());
var timeOnly = new TimeOnly(11, 1, 22);
Console.WriteLine("Output of TimeOnly is:");
Console.WriteLine(timeOnly.ToString());
Output