Changing report timezone

Hi Dear friends, I'm using Metabase version 0.42.1 and my database is MySQL Ver 15.1 Distrib 10.6.7-MariaDB. my server and my database timezone is UTC but i need my reports time to be Asia/Tehran.
i try starting up Metabase with -Duser.timezone=Asia/Tehran and change time zone in admin > localization, but still get the UTC time somehow when i change 'CreatedAt' in settings Display to the link I get ( 2022-02-22T10:10:19+03:30 ) and the time not showing right. any idea how to fix this problem?

Hi @milad

Post "Diagnostic Info" from Admin > Troubleshooting.

What is the actual database column type of "CreatedAt"?

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "ANSI_X3.4-1968",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.13+8-Ubuntu-0ubuntu1.20.04",
"java.vendor": "Ubuntu",
"java.vendor.url": "https://ubuntu.com/",
"java.version": "11.0.13",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.13+8-Ubuntu-0ubuntu1.20.04",
"os.name": "Linux",
"os.version": "5.4.106-1-pve",
"user.language": "en",
"user.timezone": "Asia/Tehran"
},
"metabase-info": {
"databases": [
"mysql",
"h2"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"date": "2022-02-17",
"tag": "v0.42.1",
"branch": "release-x.42.x",
"hash": "629f4de"
},
"settings": {
"report-timezone": "Asia/Tehran"
}
}
}

@milad Without knowing the actual column type and what your database timezone, then it's difficult.

Try playing around with these connection strings in Admin > Databases > (your-db) > Advanced > Connection Strings:
useLegacyDatetimeCode=false&noDatetimeStringSync=true&serverTimezone=UTC

Also worth reading this: Dashboard field date filters no using reporting timezone

1 Like

sorry for late reply my account was suspended.
my database time is UTC and createdAt is current_timestamp()
thanks a lot for your reply dear flamber.

@milad There's no column type current_timestamp() - that's a function. And if you want the timezone to be UTC, then change Report Timezone to UTC.

thank you flamber , i have tried this:
Try playing around with these connection strings in Admin > Databases > (your-db) > Advanced > Connection Strings:
useLegacyDatetimeCode=false&noDatetimeStringSync=true&serverTimezone=UTC
and it worked.
i don't know how to thank you dear friend

1 Like