I have a requirement to store all dates recorded in the database in UTC. For now, I can do this using the Noda library with the following method:
public static DateTime NowUtc(string timeZoneId)
{
var timeZone = GetTimeZone(timeZoneId);
var instant = SystemClock.Instance.Now;
return instant.InZone(timeZone).ToDateTimeUtc();
}
I am going to check that every date that has passed since the data access level should be in UTC format.
How do I achieve this?
thanks
Note. I created a special class library that used Noda as the main core, and the result is converted back to System.DateTime.
source
share