How to configure Timezone in REPL Clojure?

Asked

Viewed 27 times

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 the project.clj
  • Add -Duser.timezone=America/Sao_Paulo in 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 the project.clj
  • export JAVA_OPTS="-Duser.timezone=America/Sao_Paulo:$JAVA_OPTS" in the archive ~/.zshrc Nothing 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"])
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.