ReifyDB$reifydb
[Home][Contact][Support]
[> Book a Call]
  • Introduction
  • Installation
  • Quick Start
  • Basics
    • Overview
    • Filter
    • Sort
    • Overview
    • Operators
  • Overview
    • b58
    • b64
    • b64url
    • hex
    • utf8
    • advance
    • now
    • set
    • add
    • age
    • day
    • day_of_week
    • day_of_year
    • days_in_month
    • diff
    • end_of_month
    • format
    • is_leap_year
    • month
    • new
    • now
    • quarter
    • start_of_month
    • start_of_year
    • subtract
    • trunc
    • week
    • year
    • add
    • age
    • date
    • day
    • day_of_week
    • day_of_year
    • diff
    • epoch
    • epoch_millis
    • format
    • from_epoch
    • from_epoch_millis
    • hour
    • minute
    • month
    • nanosecond
    • new
    • now
    • quarter
    • second
    • subtract
    • time
    • trunc
    • week
    • year
    • add
    • days
    • format
    • get_days
    • get_months
    • get_nanos
    • hours
    • millis
    • minutes
    • months
    • negate
    • scale
    • seconds
    • subtract
    • trunc
    • weeks
    • years
    • id
    • anonymous
    • none
    • root
    • some
    • type
    • abs
    • acos
    • asin
    • atan
    • atan2
    • avg
    • ceil
    • clamp
    • cos
    • e
    • exp
    • floor
    • gcd
    • lcm
    • log
    • log10
    • log2
    • max
    • min
    • mod
    • pi
    • power
    • round
    • sign
    • sin
    • sqrt
    • sum
    • tan
    • truncate
    • type
    • ascii
    • char
    • concat
    • contains
    • count
    • ends_with
    • format_bytes
    • format_bytes_si
    • index_of
    • length
    • lower
    • pad_left
    • pad_right
    • repeat
    • replace
    • reverse
    • starts_with
    • substring
    • trim
    • trim_end
    • trim_start
    • upper
    • add
    • age
    • diff
    • format
    • hour
    • minute
    • nanosecond
    • new
    • now
    • second
    • subtract
    • trunc
duration module

duration::trunc

Truncate a duration to a specified precision.

Syntax

RQL
1
duration::trunc(duration, precision)

Parameters

NameTypeDescription
durationDurationThe duration to truncate.
precisionUtf8The precision to truncate to.

Return Value

Returns a Duration truncated to the specified precision.

Examples

$ Truncate duration to year
1
map {duration::trunc(cast('P1Y2M3DT4H5M6S', duration), 'year')}
$ ctrl+enter to run

Related Functions

duration::format
# product
  • >Documentation
  • >Blog
  • >FAQ
# resources
  • >Contact
  • >Support
  • >Book a Call
# community
  • >GitHub
  • >X (Twitter)
© 2026 ReifyDB. All Rights Reserved.
License: AGPL-3.0