【发布时间】:2020-10-17 17:46:18
【问题描述】:
在 clojure REPL 上对 postgres 数据库运行查询时,时间戳字段以 UTC 显示,我需要它们位于 America/Sao_Paulo (UTC-3) 时区
到目前为止,我在 Intellij 的 REPL 上尝试了以下方法:
- 在文件
idea.vmoptions(intellij's)中设置-Duser.timezone=America/Sao_Paulo - 将
:jvm-opts ["-Duser.timezone=America/Sao_Paulo"]添加到project.clj - 在 Intellij 的 REPL 配置中添加
-Duser.timezone=America/Sao_Paulo - 导出
JAVA_OPTS="-Duser.timezone=America/Sao_Paulo:$JAVA_OPTS"内部~/.zshrc
以及 Leiningen REPL 上的以下内容:
- 将
:jvm-opts ["-Duser.timezone=America/Sao_Paulo"]添加到project.clj - 导出
JAVA_OPTS="-Duser.timezone=America/Sao_Paulo:$JAVA_OPTS"内部~/.zshrc
到目前为止没有任何工作!
示例代码
(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"])
【问题讨论】:
标签: clojure timezone read-eval-print-loop leiningen