public static DateTime?TryReadDateTime(this IResultSetValue result) { var dateText = result.ToString(); DateTime dateTimeResult; if (DateTime.TryParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out dateTimeResult)) { return(dateTimeResult.ToUniversalTime()); } return(null); }
/// <summary> /// Converts a value to a nullable <c>string</c>. /// </summary> /// <param name="this"> /// The value to convert. /// </param> /// <returns> /// The <c>string</c>, which may be <see langword="null"/>. /// </returns> public static string ToNullableString(this IResultSetValue @this) { Ensure.ArgumentNotNull(@this, nameof(@this)); return(@this.SQLiteType == SQLiteType.Null ? null : @this.ToString()); }