Skip to main content

DATE_TRUNC

Deprecated version

This document refers to a deprecated version of the RQL programming language.

Please go here for documentation related to the latest supported version.

Truncates a timestamp or a date to the specified precision.

Valid values for precision are:

  • milliseconds
  • second
  • minute
  • hour
  • day
  • week
  • month
  • quarter
  • year
  • decade
  • century
  • millennium
Syntax
DATE_TRUNC(<string>, <timestamp or date>)
Example
date_trunc("hour", timestamp "2007-03-14 01:02:03.004") // "2007-03-14 01:00:00"
date_trunc("year", timestamp "2007-03-14 01:02:03.004") // "2007-01-01 00:00:00"