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 r093
Excerpt

This example provides an overview on various date and time functions.

Functions:

D generate list excerpts
pagesDATE Function,TIME Function,DATETIME Function,DATEFORMAT Function

Source:

yearmonthdayhourminutesecond
20161011230
20151120152230
20141225183045

Transformation: 

D trans
RawWrangletrue
p03Value'fctn_date'
Typestep
WrangleTextderive type:single value: DATEFORMAT(DATE (year, month, day),'yyyy-MM-dd') as:'fctn_date'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueDATEFORMAT(DATE (year, month, day),'yyyy-MM-dd')
p03NameNew column name
SearchTermNew formula

D trans
RawWrangletrue
p03Value'fctn_time'
Typestep
WrangleTextderive type:single value: DATEFORMAT(TIME (hour, minute, second),'HH-mm-ss') as:'fctn_time'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueDATEFORMAT(TIME (hour, minute, second),'HH-mm-ss')
p03NameNew column name
SearchTermNew formula

D trans
RawWrangletrue
p03Value'fctn_datetime'
Typestep
WrangleTextderive type:single value: DATEFORMAT(DATETIME (year, month, day, hour, minute, second),'yyyy-MM-dd-HH:mm:ss') as:'fctn_datetime'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02ValueDATEFORMAT(DATETIME (year, month, day, hour, minute, second),'yyyy-MM-dd-HH:mm:ss')
p03NameNew column name
SearchTermNew formula


Results:

Info

NOTE: All inputs must be inferred as Integer type and must be valid values for the specified input. For example, month values must be integers between 1 and 12, inclusive.

yearmonthdayhourminutesecondfctn_datefctn_timefctn_datetime
201610112302016-10-1102-03-002016-10-11-02:03:00
201511201522302015-11-2015-22-302015-11-20-15:22:30
201412251830452014-12-2518-30-452014-12-25-18:30:45

You can apply other date and time functions to the generated columns. For an example, see YEAR Function.

D s also
labelexample_date_and_time_functions