Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: Lost in DateTime !

by pcouderc (Monk)
on Jun 14, 2017 at 06:12 UTC ( [id://1192755]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Lost in DateTime !
in thread Lost in DateTime !

Please note that I do N_O_T write in the DB. I R_E_A_D it : "asterisk" (software for PABX, see WK) writes for me. My DB is soon written.
About ->parse_timestamp_with_time_zone(), pease see above to see my code. In fact, I have tried all...

Replies are listed 'Best First'.
Re^5: Lost in DateTime !
by huck (Prior) on Jun 14, 2017 at 07:33 UTC

    Please note that I do N_O_T write in the DB. I R_E_A_D it : "asterisk" (software for PABX, see WK) writes for me.

    That does not imply that asterisk is properly set up. at https://wiki.asterisk.org/wiki/display/AST/PostgreSQL+CDR+Backend it implies that the column should be "calldate timestamp NOT NULL" but it seems yours might be "calldate timestamp with timezone NOT NULL". If "asterisk" does not supply time zone information when inserting the data it is quite possible that 23:55 is being converted to GMT prior to insertion but postgres is thinking it is in paris time and converts it to GMT AGAIN to store in its database, which is then converted to 21:55+02 on output to you.

    I agree that the real solution is to fix whatever is writing into the database

Re^5: Lost in DateTime !
by poj (Abbot) on Jun 14, 2017 at 17:53 UTC

    What does this query return ?

    #!/usr/bin/perl use strict; use DBD::Pg; my $dsn = "dbi:Pg:dbname=asterisk;host=www.ibm.fr"; my $dbh = DBI->connect($dsn,'asterisk','secret') or die $DBI::errstr;; my $sql = 'SELECT CURRENT_TIMESTAMP, LOCALTIMESTAMP'; print join "\n",$dbh->selectrow_array($sql); $dbh->disconnect;
    poj

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1192755]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found