c# - Using timestamp with time zone with Npgsql -



c# - Using timestamp with time zone with Npgsql -

there need save timestamp time zone in database. target field in table declared as

"uploadtime" timestamp time zone

i'm inserting info using command parameters :

var uploadtime = datetimeoffset.now; var insertquery = @"insert ""table"" (""uploadtime"") values :uploadtime"; var uploadtimeparam = new npgsqlparameter("uploadtime", npgsqldbtype.timestamptz); uploadtimeparam.value = uploadtime; var insertcommand = new npgsqlcommand(insertquery, databaseconnection); insertcommand.parameters.add(uploadtimeparam);

value stored , returned datetime without time zone. guess that's because "timestamp timezone" database type mapped datetime default. can fixed via checking out sources , making respective changes timestamptz, interfere thought of using nuget manage project dependencies. maybe there less complicated ways accomplish that? storing ticks , converting them datetimeoffset overhead, hack "set time zone interval" before query execution didn't work in case. in advance solutions.

solved problem via storing of additional timestamp rtt field maps datetimeoffset manually.

c# .net database npgsql postgresql-9.2

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -