Fork me on GitHub
#sql
<
2018-11-07
>
mping11:11:08

Hi, is anyone able to use pgsql with timezones properly? according to docs, OffsetDateTime should be available if java8 is running

mping11:11:38

but its not working for me

mping11:11:57

(->> (clojure.java.jdbc/query {:datasource datasource} "select '2018-08-31'::timestamp without time zone as t1, '2018-08-31'::timestamp with time zone as t2;")
     first
     vals
     (map #(.getTimezoneOffset %)))
=> (-60 -60)

valtteri12:11:24

I don’t have direct answer but this helped me when I was confused http://blog.untrod.com/2016/08/actually-understanding-timezones-in-postgresql.html

mping13:11:44

tks @valtteri I think jdbc is always converting to local time

mping13:11:37

and that blog helped

seancorfield16:11:35

@mping Recommendation: always run your production infrastructure on UTC -- configure your O/S, your database, and your JVM for all processes to be UTC, with the servers set to NTP sync. It'll save a lot of complications. Timezones are hard.