Skip to main content

Overview

Databrain allows you to pass a timezone parameter (params.timezone) while generating a guest token. This ensures that:
  • SQL queries are executed in the correct timezone
  • Date/time fields are consistently formatted
  • Dashboard users across regions see accurate time-based insights

Supported Data Sources

Timezone-aware execution is supported for:
  • Clickhouse
  • Trino
  • Redshift
  • CockroachDB
  • Postgres
  • MSSQL

What is params.timezone?

params.timezone -- string
  • Accepts a valid IANA timezone string
  • Sets the database session timezone
  • Ensures all date/time operations respect the specified timezone

Common Timezone Values

TimezoneDescription
"UTC"Coordinated Universal Time
"America/New_York"Eastern Time (US)
"America/Los_Angeles"Pacific Time (US)
"Europe/London"GMT / BST
"Asia/Kolkata"Indian Standard Time
"Australia/Sydney"Australian Eastern Time

Guest Token Example with Timezone

{
  "clientId": "user-456",
  "dataAppName": "sales-dashboard",
  "params": {
    "timezone": "America/New_York"
  }
}

Step-by-Step Implementation

1

Create a DataApp and API Token

Create the required resources via the following APIs:
2

Create a Datamart via API

Ensure your dataset contains a timestamp column. Create a Datamart using the Create Datamart API and specify isApplyTimezone.
3

Create an Embed via API

Create an Embed using your created datamart via the Create Embed API inside the created DataApp.
4

Generate Guest Token with Timezone

Include the params.timezone field in your payload when calling the Guest Token API.
{
  "clientId": "user-456",
  "dataAppName": "sales-dashboard",
  "params": {
    "timezone": "America/New_York"
  }
}
Use an appropriate IANA timezone (e.g., "Asia/Kolkata").
5

Validate in Demo Link

Open your demo link, click + Create Metric, and drag and drop the date column into the chart.Then:
  1. Open Browser DevTools → Network Tab
  2. Inspect the executed query
Verify:
  • The timezone value is applied in the query/session
  • "timezone": "<your-timezone>" is present inside the request payload (params)

How It Works Internally

The timezone is applied at the database session level. Queries run as if the database is operating in that timezone. Functions like NOW(), DATE_TRUNC, and TIMESTAMP conversions will all respect the passed timezone.