internal static byte[] ToTimeStamp(NpgsqlNativeTypeInfo typeInfo, object nativeData, Boolean forExtendedQuery, NativeToBackendTypeConverterOptions options, bool arrayElement) { if (nativeData is DateTime) { return(BasicNativeToBackendTypeConverter.ToDateTime(typeInfo, nativeData, forExtendedQuery, options, arrayElement)); } else { return(BackendEncoding.UTF8Encoding.GetBytes(nativeData.ToString())); } }
internal static byte[] ToTimeTZ(NpgsqlNativeTypeInfo typeInfo, object nativeData, Boolean forExtendedQuery, NativeToBackendTypeConverterOptions options, bool arrayElement) { if (nativeData is DateTime) { return(BasicNativeToBackendTypeConverter.ToTime(typeInfo, nativeData, forExtendedQuery, options, arrayElement)); } NpgsqlTimeTZ time; if (nativeData is TimeSpan) { time = (NpgsqlTimeTZ)(TimeSpan)nativeData; } else { time = (NpgsqlTimeTZ)nativeData; } return(BackendEncoding.UTF8Encoding.GetBytes(time.ToString())); }