Skip to main content

Time Zone

Use time_zone to control time-zone-sensitive SQL expressions and understand how time zones affect loads, command output, and stored timestamps.

Time zones show up in several places, and they don't all follow the same rule. One distinction, wall-clock versus instant, explains the rest.

Wall-clock and instant​

VeloDB Cloud works with two kinds of time value:

  • Wall-clock: a calendar reading like 2026-06-26 10:00:00, with no zone attached. DATE and DATETIME columns store this. It is shown exactly as written, and time_zone never changes it.
  • Instant: an absolute point in time, stored as a count of seconds since 1970-01-01 00:00:00 UTC. It has no hours or minutes until you pick a zone. Unix timestamps and internal job timestamps represent instants. Functions such as NOW() convert the current instant to a date and time in the session zone.

A zone only matters when converting between the two. The same instant becomes a different wall-clock in each zone:

SET time_zone = '+00:00'; SELECT FROM_UNIXTIME(1000000000); -- 2001-09-09 01:46:40
SET time_zone = 'Asia/Tokyo'; SELECT FROM_UNIXTIME(1000000000); -- 2001-09-09 10:46:40

The stored instant is identical. Only the shown clock changes.

Time zone variables​

VariableWritableWhat it does
time_zoneYesThe active zone. Converts instants to and from wall-clock.
system_time_zoneNo (read-only)Reports the server's own zone, detected at startup. Informational.
SELECT @@time_zone; -- the active zone
SET time_zone = 'America/New_York'; -- this session only
SET GLOBAL time_zone = '+00:00'; -- requires ADMIN_PRIV

New sessions inherit the global time_zone default. Check the effective value instead of assuming that the service uses your local zone. Setting GLOBAL requires the warehouse SQL ADMIN_PRIV privilege and affects the current session and future sessions. Other existing sessions keep their settings.

Changing time_zone does not rewrite stored data. It changes time-zone-sensitive conversions and function results.

Stored table data​

DATE and DATETIME columns are wall-clock. Write 2026-06-26 10:00:00, read back 2026-06-26 10:00:00, in any session, under any time_zone. Changing time_zone does not rewrite or reinterpret these stored values. Input strings that include an offset can be converted before storage, so choose a consistent target zone during ingestion.

TIMESTAMPTZ differs from DATETIME: it represents an instant, and its displayed date, time, and offset follow the session zone. See TIMESTAMPTZ conversion.

Time functions​

These functions convert instants to or from wall-clock, so they use your session time_zone:

FunctionEffect
NOW(), CURRENT_TIMESTAMP(), CURDATE()Current instant as wall-clock in your zone
UNIX_TIMESTAMP(datetime)Reads the datetime as wall-clock in your zone, returns the instant
FROM_UNIXTIME(instant)Converts an instant to wall-clock in your zone
CONVERT_TZ(dt, from, to)Converts between two zones you name; ignores time_zone

NOW() is fixed once per query, so a distributed query returns the same value everywhere.

Loads​

Load methods accept a timezone setting for time-zone-sensitive functions and input conversion. Set it explicitly when consistent interpretation matters. An HTTP Stream Load request is independent of a SQL client session, so changing time_zone in that SQL client does not configure the HTTP request. Broker Load and Routine Load capture the submitting session zone when no timezone is supplied.

Load methodHow to set it
Stream Loadtimezone HTTP header. See Stream Load.
Broker Load / S3 Loadtimezone in PROPERTIES. See Broker Load.
Routine Loadtimezone in job PROPERTIES. See Routine Load.
MySQL Loadtimezone property. See MySQL Load.

Use the generated endpoint described in Stream Load. Replace <stream-load-endpoint> with that endpoint, including its scheme, and replace the user, database, and table placeholders. curl prompts for the password.

curl --location-trusted -u "<warehouse-user>" \
-H "timezone: America/New_York" \
-T data.csv -X PUT \
"<stream-load-endpoint>/api/<database-name>/<table-name>/_stream_load"

For SQL expressions in INSERT, SELECT INTO OUTFILE, and EXPORT, set time_zone in the submitting session before running the statement.

Times in SHOW commands and system tables​

Job and load metadata can contain timestamps formatted when you request them. The zone depends on the specific command or table, so do not assume that every system table uses the global time_zone. For example, information_schema.active_queries, information_schema.partitions, and catalog metadata cache statistics accept the requesting session's zone. Background job metadata can use the global default when no session context is available.

When comparing the same event through different interfaces, check the session and global settings:

SELECT @@session.time_zone, @@global.time_zone;
SHOW ROUTINE LOAD;
SELECT * FROM information_schema.routine_load_jobs;
SELECT * FROM jobs("type"="insert");

Also distinguish timestamps stored as table data from timestamps formatted at query time. Changing a session variable cannot reformat a date and time already written to a DATETIME or text column.

Query audit​

Audit times are formatted when the audit record is produced and persisted in __internal_schema.audit_log. Changing your query session's time_zone does not reformat existing rows. Check the recorded zone when correlating audit records with job metadata or Console displays.

The Time(ms), CpuTimeMS, and similar counters are durations in milliseconds, not clock times.

VeloDB Cloud Console​

Console pages can display times in the viewer's browser zone. For example, Warehouse Settings shows the browser's UTC offset beside the maintenance window. Follow the zone or offset shown on the page when choosing a time range or schedule.

A Console display can differ from SQL because the browser zone and SQL time_zone are separate settings. Setting time_zone does not change the browser zone.

Accepted zone formats​

  • Named zones: America/New_York, Europe/London, Asia/Tokyo.
  • Fixed offsets: +09:00, -05:30, +00:00.
  • Aliases: UTC and GMT mean UTC. CST resolves to Asia/Shanghai (+08:00), rather than US Central. For US Central, use America/Chicago.

Named zones follow the daylight saving rules defined for that zone. For example, America/Los_Angeles shifts from -08:00 to -07:00 in spring and back in autumn, so the same wall-clock maps to a different instant across the year. To pin a constant offset and opt out of DST, use a fixed offset like -08:00 instead of a named zone.

At a glance​

SurfaceZone it uses
Stored DATE/DATETIMENone (shown as written)
NOW(), UNIX_TIMESTAMP(), FROM_UNIXTIME()Session time_zone
LoadsExplicit timezone, or the load method's default
Timestamp formatting in SHOW commandsSession time_zone where used by the command
System tables and table functionsSpecific to the table and request context. Persisted dates and text keep their recorded values.
VeloDB Cloud ConsoleFollow the zone or offset displayed on the page

See also​

Ask AI