2
How to set up REPL with the correct Timezone?
When executing a query in a postgres database through a REPL the date fields are in UTC time zone I want to configure it for America/Sao_paulo.
In Intellij REPL I tried the following:
- Configure the idea.vmoptions (intellij) file with the parameter
-Duser.timezone=America/Sao_Paulo - Add
:jvm-opts ["-Duser.timezone=America/Sao_Paulo"]in theproject.clj - Add
-Duser.timezone=America/Sao_Pauloin REPL configuration by intellij export JAVA_OPTS="-Duser.timezone=America/Sao_Paulo:$JAVA_OPTS"in the archive~/.zshrc
and in REPL Leiningen:
- Add
:jvm-opts ["-Duser.timezone=America/Sao_Paulo"]in theproject.clj export JAVA_OPTS="-Duser.timezone=America/Sao_Paulo:$JAVA_OPTS"in the archive~/.zshrcNothing worked out for me!
Example
(ns experiments
(:require [next.jdbc :as jdbc]))
(def db
{:dbtype "postgres"
:dbname "<dbname>"
:host "<host>"
:port 5432
:user "<user>"
:password "<pass>"})
(def ds (jdbc/get-datasource db))
(jdbc/execute! ds ["select current_timestamp"])