How to convert date time field to given time zone

Hi,

My application database is MongoDB, I have one date field which have UTC time zone value How do I convert that date into given time zone (that could be any time zone) which we get as variable.

How can I convert that and show into report, currently it is showing one day before date for IST time.

Diagnostic info:

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.62 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.13+8",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.13",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.13+8",
"os.name": "Linux",
"os.version": "4.14.171-105.231.amzn1.x86_64",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"mongo"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "11.13"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.2.23"
}
},
"run-mode": "prod",
"version": {
"date": "2022-01-10",
"tag": "v0.41.6",
"branch": "release-x.41.x",
"hash": "296635f"
},
"settings": {
"report-timezone": "UTC"
}
}
}

Hi @ritz
The easiest would be to create a View on Mongo, where you do the manipulation of the data.

Thanks for your quick reply @flamber

How database view can work for this problem? as we have to display dates in different different time zones according user time zone configuration.

@ritz I don't understand. Metabase does currently not support showing different timezone per user, but it's something we're working on:
https://github.com/metabase/metabase/issues/4284 - upvote by clicking :+1: on the first post

You would have to convert your different timezones to a single timezone until then. Use a View on Mongo: https://docs.mongodb.com/manual/core/views/

Latest release is 0.43.2: https://github.com/metabase/metabase/releases/latest

@flamber Thanks.