/// <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="guid">A sequential Guid with the first 8 bytes containing the system ticks at time of generation</param> /// <returns>DateTime?</returns> public static DateTime?ToDateTime(this Guid guid) { var ticks = guid.ToTicks(); if (ticks.IsDateTime()) { return(ticks.ToDateTime()); } //Try conversion through sql guid ticks = new SqlGuid(guid).ToGuid().ToTicks(); return(ticks.IsDateTime() ? ticks.ToDateTime() : default(DateTime?)); }