Here is my problem:
I want to calculate how long the record has been updated in the database.
The database is in PostgreSQL, the update_time field is populated with the trigger that it uses CURRENT_TIMESTAMP(2). The field is inflated to a DateTimeDBIx :: Class object . I get the current time in my code usingDateTime->now()
My problem is that when I get the field value, it turns off 1 hour (i.e. 1 hour earlier DateTime->now()). I am in the CET time zone, therefore 1 hour earlier than UTC.
The correct way to solve the problem is probably at the database level. I tried replacing CURRENT_TIMESTAMPwith LOCALTIMESTAMP, but to no avail.
I think that in fact a more reliable solution (that is, one that does not rely on getting the right to the database) will be to get the current timestamp from the database itself. I really need an era since I use it to calculate the difference.
So the question is: is there an easy way to do this: get the current time from the database using DBIx :: Class?
Another way to get DB and DateTime to agree is that the current time will also be OK!
mirod source
share