コード例 #1
0
 /// <summary>
 /// Returns the equivalent Universal Time (UTC) of this local date value.
 /// </summary>
 public static DateTime ToUniversal(this DateTime localValue)
 {
     return(localValue.ToUniversal(sourceTimezone: LocalTime.CurrentTimeZone()));
 }
コード例 #2
0
 /// <summary>
 /// Returns the local time equivalent of this UTC date value based on the TimeZone specified in Localtime.CurrentTimeZone().
 /// Use this instead of ToLocalTime() so you get control over the TimeZone.
 /// </summary>
 public static DateTime ToLocal(this DateTime utcValue) => utcValue.ToLocal(LocalTime.CurrentTimeZone());