Skip to main content

TO_WEEKS

Introduced or updated: v1.2.677

Converts a specified number of weeks into an Interval type.

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

Syntax

TO_WEEKS(<weeks>)

Return Type

Interval (represented in days).

Examples

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

┌───────────────────────────────────────────┐
│ to_weeks(2) │ to_weeks(0) │ to_weeks(- 2)
├─────────────┼─────────────┼───────────────┤
14 days │ 00:00:00-14 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