I want to convert UTC date fields to Asia/Hong_Kong timezone in the query result. But with couple hours of attempts, still cannot get it to work.
my basic info:
- datasource: postgresql, UTC, the date field without explicit timezone
- metabase JAVA_Timezone: Asia/Hong_Kong
3 metabase report timezone: Asia/Hong_kong - metabase version: 0.34.2
my diagnostic info:
{
"browser-info": {
"language": "zh-CN",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.5+10",
"java.vendor": "AdoptOpenJDK",
"java.vendor.url": "https://adoptopenjdk.net/",
"java.version": "11.0.5",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.5+10",
"os.name": "Linux",
"os.version": "4.15.0-66-generic",
"user.language": "en",
"user.timezone": "Asia/Hong_Kong"
},
"metabase-info": {
"databases": [
"postgres",
"h2"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "10.9 (Debian 10.9-1.pgdg90+1)"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.2.8"
}
},
"run-mode": "prod",
"version": {
"date": "2020-02-04",
"tag": "v0.34.2",
"branch": "release-0.34.x",
"hash": "dab738c"
},
"settings": {
"report-timezone": "Asia/Hong_Kong"
}
}
}
the thread is:
bash-5.0# ps
PID USER TIME COMMAND
1 metabase 1:04 java -XX:+IgnoreUnrecognizedVMOptions -Dfile.encoding=UTF-8 -Dlogfile.path=target/log -server -Duser.timezone=Asia/Hong_Kong -jar /app/metabase.jar
I tried:
- use db user that have full permissions to connect postgresql
- set metabase system timezone to Aisa/Hong_Kong
bash-5.0# date -R
Sun, 01 Mar 2020 17:51:58 +0800
I didn't see any error in logs, but I still get UTC value.
How do I get it work?
PS. I run metabase on docker, and also use postgresql as metabase applicaiton db. But I didn't feel that this could be a problem.