weeknum

Returns the week number from its timestamp argument.

Example

weeknum(timestamp("2014-01-01 00:00:00"))

This example returns 1.

Syntax

weeknum(timestamp expr t)
  • t : an expression evaluating to a timestamp

    Returns

    int

Description

Function weeknum takes in a date expression in the format “yyyy-MM-dd HH:mm:ss” and returns the week number in the year of that date or timestamp.