Convert to and from DateTimeOffset and DateOnly in C#
From DateTimeOffset to DateOnly: var myDateOnly = DateOnly.FromDateTime(myDate.Date); From DateOnly to DateTimeOffset: var myDto = new(myDateOnly.Year, myDateOnly.Month, myDateOnly.Day, 0, 0, 0, TimeSpan.FromHours(10));