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


Picture showing the output of Dateonly and Timeonly struct in c#





Posted By  -  Karan Gupta
 
Posted On  -  Friday, December 8, 2023

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250