postgresql - Why a npgsql query get a different now value as direct server query -


i'm trying execute stored procedure in postgres using .net , npgsql return now() value.

running .net

strsql = "select aa_realtime2();" cmd = new npgsqlcommand(strsql, connread) strsql = cmd.executescalar() 

i "2014-04-07 22:07:33.015+02"

but if run server

select aa_realtime2(); 

i "2014-04-07 15:38:11.734-04:30"

my local time gmt -4:30 server ok.

postgres , .net app on same pc.

to me both values similar time given in different time zones.

i'd quote http://www.depesz.com/2014/04/04/how-to-deal-with-timestamps/ because discusses similar issue.

[…] well, whenever dealing timestamptz values, if timezone not specified – postgresql uses configured timezone.

and can configure in multiple ways:

timezone “guc" in postgresql.conf alter database … set timezone = ‘…' alter user … set timezone = ‘…' set timezone = ‘…' 

first 1 used specify in timezone server is. or – default timezone used unless else changes default.

the next 2 change defaults given database , user.

the last 1 can used if want db connection work under different setting. […]

is possible database connections use different time zones?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -