30 JUNE 2021
In this example assume the real time in the UK is 15:30 (we are in summer, Daylight Savings time). When DateTimeOffset.UtcNow is saved to the database it saves 14:30 (+00:00). When this time is displayed on a page to the user it will show 1hr earlier than it was.
To render it correctly with the correct time use the following code:
// C# code
// 14:30 (+00:00)
var myDateTimeOffset = exportRecord.CreatedDateTimeOffset;
var timeZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
// 15:30 (+01:00)
return myDateTimeOffset.ToOffset(timeZone.GetUtcOffset(myDateTimeOffset));