public void ProviderDateTimeSupportNpgsqlDbType() { ExecuteNonQuery(@"insert into data (field_timestamp) values ('2002-02-02 09:00:23.345')"); var command = new NpgsqlCommand("select field_timestamp from data", Conn); NpgsqlTimeStamp ts; using (var reader = command.ExecuteReader()) { reader.Read(); ts = reader.GetTimeStamp(0); } Assert.AreEqual("2002-02-02 09:00:23.345", ts.ToString()); var culture = new DateTimeFormatInfo(); culture.TimeSeparator = ":"; var ts1 = NpgsqlTimeStamp.Parse("2004-06-04 09:48:00"); command.CommandText = "insert into data(field_timestamp) values (:a);"; command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Timestamp)); command.Parameters[0].Value = ts1; command.ExecuteScalar(); }
internal static object ToTimeStamp(NpgsqlBackendTypeInfo typeInfo, byte[] bBackendData, Int16 typeSize, Int32 typeModifier) { string backendData = BackendEncoding.UTF8Encoding.GetString(bBackendData); return(NpgsqlTimeStamp.Parse(backendData)); }
internal static object ToTimeStamp(NpgsqlBackendTypeInfo typeInfo, String backendData, Int16 typeSize, Int32 typeModifier) { return(NpgsqlTimeStamp.Parse(backendData)); }