I have a requirement to store all of the dates recorded in database must be recorded as UTC. So far I can achieve this using Noda library with following method:
public static DateTime NowUtc(string timeZoneId)
{
var timeZone = GetTimeZone(timeZoneId);
var instant = SystemClock.Instance.Now;
return instant.InZone(timeZone).ToDateTimeUtc();
}
I'm going to validate every date that passed into data access layer must be in UTC format.
How do I achieve that?
Thanks
Note: I have created a custom class library that used Noda as the core engine and the output is converted back to System.DateTime.