/// <summary> /// Will return the value of DateTime.UtcNow at the time of the generation of the Guid will keep you from storing separate audit fields /// </summary> /// <param name="sqlGuid">A sequential SqlGuid with the first sorted 8 bytes containing the system ticks at time of generation</param> /// <returns>DateTime?</returns> public static DateTime?ToDateTime(this SqlGuid sqlGuid) => sqlGuid.ToGuid().ToDateTime();
/// <summary> /// Will return the value of SystemClock.Instance.GetCurrentInstant() at the time of the generation of the Guid will keep you from needing to store separate audit fields /// </summary> /// <param name="sqlGuid">A sequential SqlGuid with the first sorted 8 bytes containing the system ticks at time of generation</param> /// <returns>Instant?</returns> public static Instant?ToInstant(this SqlGuid sqlGuid) { var val = sqlGuid.ToGuid().ToDateTime(); return(val.HasValue ? Instant.FromDateTimeUtc(val.Value) : default(Instant?)); }