Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r095

D toc

Excerpt

Generates a date value from three inputs of Integer type: year, month, and day.

  • Source values can be Integer literals or column references to values that can be inferred as Integers.
  • If any of the source values are invalid or out of range, a missing value is returned.
  • This function must be nested within another function that accepts date values, such as DATEFORMAT, as arguments. See the example below.

D s lang vs sql

D s
snippetBasic

Integer literal values:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value: dateformat(date(2015,02,15),'yyyy-MM-dd')

dateformat(date(2015,02,15),'yyyy-MM-dd')

Output: Returns the formatted date value: 2015-02-15.

Column reference values:

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value: dateformat(date(myYear, myMonth, myDay),'MMM yyyy')

dateformat(date(myYear, myMonth, myDay),'MMM yyyy')

Output: Returns date values based on three columns, formatted for date.


D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:dateformat(date(year_integer_col,month_integer_col,day_Integer_col ),'date_format_string')

dateformat(date(year_integer_col,month_integer_col,day_Integer_col ),'date_format_string')


ArgumentRequired?Data TypeDescription
year_integer_colYintegerName of column or Integer literal representing the year value to apply to the function
month_integer_colYintegerName of column or Integer literal representing the month value to apply to the function
day_integer_colYintegerName of column or Integer literal representing the day value to apply to the function
date_format_stringYstringString literal identifying the date format to apply to the value

D s lang notes

year_integer_col

Integer literal or name of the column containing integer values for the year.

  • Missing values for this function in the source data result in missing values in the output.
  • Multiple columns and wildcards are not supported.

D s
snippetusage

 

Required?Data TypeExample Value
YesInteger (literal or column reference)2015

month_integer_col

Integer literal or name of the column containing integer values for the month.

  • Values must be 1 or more, with a maximum value of 12.
  • Missing values for this function in the source data result in missing values in the output.
  • Multiple columns and wildcards are not supported.

D s
snippetusage

Required?Data TypeExample Value
YesInteger (literal or column reference)4

day_integer_col

Integer literal or name of the column containing integer values for the day.

  • Values must be 1 or more, with a maximum value for any month of 31.
  • Missing values for this function in the source data result in missing values in the output.
  • Multiple columns and wildcards are not supported.

D s
snippetusage

Required?Data TypeExample Value
YesInteger (literal or column reference)26

date_format_string

String literal that describes how the date value is formatted. 

D s
snippetusage

Required?Data TypeExample Value
YesString literal value'yyyy-MM-dd'

For more information, see DATEFORMAT Function.

D s
snippetExamples

Example - date and time functions

Include Page
EXAMPLE - DATE and TIME Functions
EXAMPLE - DATE and TIME Functions

D s also
labeldate