Page tree

Trifacta Dataprep



Contents:

If you licensed Dataprep by Trifacta before Oct. 14, 2020, you are using the Dataprep by Trifacta Legacy product edition. On October 14, 2022, this product edition will be decommissioned by Google and will be no longer available for use. Current customers of this product edition are encouraged to transition to one of the product editions hosted by Trifacta. See Product Editions.

   

Derives the month integer value from a Datetime value. Source value can be a a reference to a column containing Datetime values or a literal.

NOTE: If the source Datetime value does not include a valid input for this function, a missing value is returned.

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

month(MyDate)

Output: Returns the numeric month values from the MyDate column.

Syntax and Arguments

month(datetime_col)


ArgumentRequired?Data TypeDescription
datetime_colYdatetimeName of column whose month values are to be computed

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

datetime_col

Name of the column whose month value is to be computed.

  • 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 TypeExample Value
YesDatetimemyDate

Examples

Tip: For additional examples, see Common Tasks.

Example - Date element functions

This example illustrates to how to use date-related functions to derive specific values for a Datetime column type.

Functions:

ItemDescription
YEAR Function Derives the four-digit year value from a Datetime value. Source value can be a a reference to a column containing Datetime values or a literal.
MONTH Function Derives the month integer value from a Datetime value. Source value can be a a reference to a column containing Datetime values or a literal.
MONTHNAME Function Derives the full name from a Datetime value of the corresponding month as a String. Source value can be a reference to a column containing Datetime values or a literal.
WEEKDAYNAME Function Derives the full name from a Datetime value of the corresponding weekday as a String. Source value can be a reference to a column containing Datetime values or a literal.
DAY Function Derives the numeric day value from a Datetime value. Source value can be a a reference to a column containing Datetime values or a literal.
HOUR Function Derives the hour value from a Datetime value. Generated hours are expressed according to the 24-hour clock.
MINUTE Function Derives the minutes value from a Datetime value. Minutes are expressed as integers from 0 to 59.
SECOND Function Derives the seconds value from a Datetime value. Source value can be a a reference to a column containing Datetime values or a literal.

Source:

date
2/8/16 15:41
12/30/15 0:00
4/26/15 7:07

Transformation: 

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula YEAR (date)

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula MONTH (date)

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula MONTHNAME (date)

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula WEEKDAYNAME (date)

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula DAY (date)

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula HOUR (date)

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula MINUTE (date)

Transformation Name New formula
Parameter: Formula type Single row formula
Parameter: Formula SECOND (date)

Results:

NOTE: If the source Datetime value does not contain a valid input for one of these functions, no value is returned. See the second_date column below.

dateyear_datemonth_datemonthname_dateweekdayname_dateday_datehour_dateminute_datesecond_date
2/8/16 15:4120162FebruaryMonday81541 
12/30/15 0:00201512DecemberWednesday3000 
4/26/15 7:0720154AprilSunday2677 

See Also for EXAMPLE - Date Functions:

 

This page has no comments.