Skip to main content

TO_DAYS

Introduced or updated: v1.2.677

Converts a specified number of days into an Interval type.

  • Accepts positive integers, zero, and negative integers as input.

Syntax

TO_DAYS(<days>)

Return Type

Interval (represented in days).

Examples

SELECT TO_DAYS(2), TO_DAYS(0), TO_DAYS(-2);

┌────────────────────────────────────────┐
│ to_days(2) │ to_days(0) │ to_days(- 2)
├────────────┼────────────┼──────────────┤
2 days │ 00:00:00-2 days │
└────────────────────────────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today