Excerpt |
---|
This example provides an overview on various date and time functions. |
Functions:
D generate list excerpts |
---|
pages | DATE Function,TIME Function,DATETIME Function,DATEFORMAT Function |
---|
|
Source:
year | month | day | hour | minute | second |
---|
2016 | 10 | 11 | 2 | 3 | 0 |
2015 | 11 | 20 | 15 | 22 | 30 |
2014 | 12 | 25 | 18 | 30 | 45 |
Transformation:
D trans |
---|
RawWrangle | true |
---|
p03Value | 'fctn_date' |
---|
Type | step |
---|
WrangleText | derive type:single value: DATEFORMAT(DATE (year, month, day),'yyyy-MM-dd') as:'fctn_date' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | DATEFORMAT(DATE (year, month, day),'yyyy-MM-dd') |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
D trans |
---|
RawWrangle | true |
---|
p03Value | 'fctn_time' |
---|
Type | step |
---|
WrangleText | derive type:single value: DATEFORMAT(TIME (hour, minute, second),'HH-mm-ss') as:'fctn_time' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | DATEFORMAT(TIME (hour, minute, second),'HH-mm-ss') |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
D trans |
---|
RawWrangle | true |
---|
p03Value | 'fctn_datetime' |
---|
Type | step |
---|
WrangleText | derive type:single value: DATEFORMAT(DATETIME (year, month, day, hour, minute, second),'yyyy-MM-dd-HH:mm:ss') as:'fctn_datetime' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | DATEFORMAT(DATETIME (year, month, day, hour, minute, second),'yyyy-MM-dd-HH:mm:ss') |
---|
p03Name | New column name |
---|
SearchTerm | New 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. |
year | month | day | hour | minute | second | fctn_date | fctn_time | fctn_datetime |
---|
2016 | 10 | 11 | 2 | 3 | 0 | 2016-10-11 | 02-03-00 | 2016-10-11-02:03:00 |
2015 | 11 | 20 | 15 | 22 | 30 | 2015-11-20 | 15-22-30 | 2015-11-20-15:22:30 |
2014 | 12 | 25 | 18 | 30 | 45 | 2014-12-25 | 18-30-45 | 2014-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 |
---|
label | example_date_and_time_functions |
---|
|