YEARWEEK

Returns the year and weeknumber that the specified date falls on.

Sample Usage

YEARWEEK(Date)

Syntax

YEARWEEK(X [,Input Format])

Parameters:

  • X - a field or expression that evaluates to text, number, or date.
  • Input Format - format for X. Optional if X is correctly configured as a semantic date field.

Input format

YEARWEEK accepts the following input formats if X is a text field.

  • Any valid strptime format is accepted.
  • 'BASIC': %Y/%m/%d-%H:%M:%S
  • 'DEFAULT_DASH': %Y-%m-%d [%H:%M:%S]
  • 'DEFAULT_SLASH': %Y/%m/%d [%H:%M:%S]
  • 'DEFAULT_DECIMAL': %Y%m%d [%H:%M:%S
  • 'RFC_1123': for example, Sat, 24 May 2008 20:09:47 GMT
  • 'RFC_3339': for example, 2008-05-24T20:09:47Z
  • 'DECIMAL_DATE': same as 'DEFAULT_DECIMAL'

YEARWEEK accepts the following input format if X is a numerical field.

  • 'SECONDS': seconds since Epoch
  • 'MILLIS': milliseconds since Epoch
  • 'MICROS': microseconds since Epoch
  • 'NANOS': nanoseconds since Epoch
  • 'JULIAN_DATE': days since Epoch

Examples

Formula Input Output
YEARWEEK(Hit time) Jan 1, 2019 201901
YEARWEEK(Hit time, 'BASIC') 2019/01/01-09:40:45 201901
YEARWEEK(Hit time, 'SECONDS') 1561784874 201926
YEARWEEK(Hit time, 'MILLIS') 1562004058620 201927

Related resources

Was this helpful?
How can we improve it?