Date/Time Operators

Data 360 Query Guide, mirrored from developer.salesforce.com: **Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

markdownreferencev19SA8-WMF2guide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sqlDate/Time OperatorsData 360Data CloudData 360 Query Guide

Created 23 Oct 2026 · Modified 23 Oct 2026 · 1 version

Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/datetime-operators.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

Date/Time Operators

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Arithmetic and time-zone operators for dates, times, timestamps, and intervals.

The + and * operators have commutative pairs. For example, both date + integer and integer + date are valid.

OperationReturn TypeExample
date + integerdatedate '2024-03-15' + 7 → 2024-03-22
date + intervaltimestampdate '2024-03-15' + interval '1 day' → 2024-03-16 00:00:00
date + timetimestampdate '2024-03-15' + time '10:00:00' → 2024-03-15 10:00:00
interval + intervalintervalinterval '1 hour' + interval '30 minutes' → 01:30:00
timestamp + intervaltimestamptimestamp '2024-03-15 12:00:00' + interval '2 hours' → 2024-03-15 14:00:00
time + intervaltimetime '12:00:00' + interval '1 hour' → 13:00:00
- intervalinterval- interval '1 hour' → -01:00:00
date - dateintegerdate '2024-03-22' - date '2024-03-15' → 7
date - integerdatedate '2024-03-22' - 7 → 2024-03-15
date - intervaltimestampdate '2024-03-16' - interval '1 day' → 2024-03-15 00:00:00
time - timeintervaltime '14:00:00' - time '12:00:00' → 02:00:00
time - intervaltimetime '13:00:00' - interval '1 hour' → 12:00:00
timestamp - intervaltimestamptimestamp '2024-03-15 14:00:00' - interval '2 hours' → 2024-03-15 12:00:00
interval - intervalintervalinterval '1 hour' - interval '30 minutes' → 00:30:00
timestamp - timestampintervaltimestamp '2024-03-15 14:00:00' - timestamp '2024-03-15 12:00:00' → 02:00:00
interval * integerintervalinterval '30 minutes' * 2 → 01:00:00
interval * double precisionintervalinterval '1 hour' * 1.5 → 01:30:00
interval / double precisionintervalinterval '1 hour' / 2 → 00:30:00

Use the at time zone operator to convert between timestamp and timestamp with time zone values. Specify the time zone as a name or as a UTC offset interval.

OperationReturn TypeExample
timestamp at time zone 'timezone'timestamptztimestamp '2001-08-16 20:38:40' at time zone 'Europe/Berlin' → 2001-08-16 18:38:40+00 (assumes the default time zone is UTC)
timestamptz at time zone 'timezone'timestamptimestamptz '2001-08-16 18:38:40+00' at time zone 'Europe/Berlin' → 2001-08-16 20:38:40
timestamp at time zone interval 'interval'timestamptztimestamp '2001-08-16 20:38:40' at time zone interval '+2:00' → 2001-08-16 18:38:40+00 (assumes the default time zone is UTC)
timestamptz at time zone interval 'interval'timestamptimestamptz '2001-08-16 18:38:40+00' at time zone interval '+2:00' → 2001-08-16 20:38:40
  • Data 360 SQL outputs interval data in the ISO-8601 style. For example, P1DT2H3M4S corresponds to 1 day, 2 hours, 3 minutes, and 4 seconds.
  • To find the number of seconds between two timestamps and adjust for month lengths, time zone changes, and daylight saving time, use EXTRACT(EPOCH FROM ...) on each value and subtract the results. The - operator makes the same adjustments but returns the result as an interval of days, hours, minutes, and seconds.

These queries show the difference between the two approaches. The samples use timezone = 'US/Eastern' and span a daylight saving time change.

Read this document as markdown — the same bytes an agent receives.