Skip to main content

SERIALNUMBER Function

Generates a serial date number from a valid date value.

  • Serial date number values begin with January 1, 1900.

  • Source values can be a valid date or output of a function that generates a valid date.

Wrangle vs. SQL: This function is part of Wrangle, a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.

Basic Usage

Integer literal values:

serialnumber(date(2015,02,15))

Output: Returns the serial date number for February 15, 2015.

Column reference values:

serialnumber(date(myYear, myMonth, myDay))

Output: Returns serial date number based on three input columns, which contain valid values for day, month, and year in the calendar.

Syntax and Arguments

serialnumber(date_col)

Argument

Required?

Data Type

Description

date_col

Y

Datetime

Date literal, name of column containing valid date values, or function returning a valid date value.

For more information on syntax standards, see Language Documentation Syntax Notes.

date_col

Date literal, column containing date values, or function returning date values. Time values in the input value are not used.

  • Missing values for this function in the source data result in missing values in the output.

  • Multiple columns and wildcards are not supported.

Usage Notes:

Required?

Data Type

Example Value

Yes

Datetime (literal,column reference, or function)

DATE(2020,01,02)

Examples

Suggerimento

For additional examples, see Common Tasks.

Example - serial date numbers

Source:

eventId

Year

Month

Day

e001

2021

01

01

e002

2021

01

02

e003

2021

01

03

e004

2021

01

04

e005

2021

01

05

Transformation:

Transformation Name

New formula

Parameter: Formula type

Single row formula

Parameter: Formula

serialnumber(date(Year, Month, Day))

Parameter: New column name

'datSerialNumber'

Results:

eventId

Year

Month

Day

datSerialNumber

e001

2021

01

01

44197

e002

2021

01

02

44198

e003

2021

01

03

44199

e004

2021

01

04

44200

e005

2021

01

05

44201