Page tree

 

Support | BlogContact Us | 844.332.2821

 

Contents:

This documentation applies to Trifacta Wrangler. Download this free product.
Registered users of this product or Trifacta Wrangler Enterprise should login to Product Docs through the application.

This example illustrates how the DATE and TIME functions operate. Both functions require that their outputs be formatted properly using the DATEFORMAT function.

  • DATE - Generates valid Datetime values from three integer inputs: year, month, and day. See DATE Function.
  • TIME - Generates valid Datetime values from three integer inputs: hour, minute, and second. See TIME Function.
  • DATETIME - Generates valid Datetime values from six integer inputs: year, month, day, hour, minute, and second. See DATETIME Function.
  • DATEFORMAT - Formats valid Datetime values according to the provided formatting string. See DATEFORMAT Function.

Source:

yearmonthdayhourminutesecond
20161011230
20151120152230
20141225183045

Transform:

derive value: DATEFORMAT(DATE (year, month, day),'yyyy-MM-dd') as:'fctn_date'

derive value: DATEFORMAT(TIME (hour, minute, second),'HH-mm-ss') as:'fctn_time'

derive value: DATEFORMAT(DATETIME (year, month, day, hour, minute, second),'yyyy-MM-dd-HH:mm:ss') as:'fctn_datetime'


Results:

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

Your Rating: Results: PatheticBadOKGoodOutstanding! 4 rates

This page has no comments.