Page tree

Release 5.1



Derives the value for the current date in UTC time zone. You can specify a different time zone by optional parameter.

For this function, the values that you see in the Transformer grid are generated during the preview. These values will differ from the values that are generated later, when the job is executed.

NOTE: Some Datetime functions do not allow the nesting of NOW and TODAY functions. You should create a separate column containing these values.

Other differences:

  • If you refresh the page for the Transformer grid, the function is recalculated. 
  • If you re-open the dataset in the Transformer page, the function is recalculated.
  • If you have multiple versions of the function in the same dataset, you are likely to end up with different generated timestamps. The difference in their values cannot be accurately predicted. 

Tip: If you wish to use the same computed value for this function across your dataset, you should generate a column containing values for the function and then base all of your other calculations off of these column values.

NOTE: If no time zone is specified, the default is UTC time zone.

For more information on generating the date and time stamp value for the current time, see NOW Function.

Basic Usage

Basic Example:

derive type:single value:TODAY() as:'nowTime'

Output: Generates a column of values that contain the Datetime value for the current date in UTC time zone.

Example with Time Zone:

derive type:single value:TODAY('America/New York') as:'nowTime'

Output: Generates a column of values that contain the Datetime value for the current date based on the time in the Eastern U.S. time zone.

Syntax and Arguments

derive type:single value:TODAY(str_timezone)

ArgumentRequired?Data TypeDescription
str_timezoneNstringString value for the time zone for which the date value is calculated.

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


String value for the time zone to use.

For a list of supported values for time zones, see Supported Time Zone Values.

Usage Notes:

Required?Data TypeExample Value
NoString'America/New York'


Tip: For additional examples, see Common Tasks.

Example - Flight Status report

This example illustrates how the NOW and TODAY functions operate. Both functions generate outputs of Datetime data type.
  • NOW - Generates valid Datetime values for the current timestamp in the specified time zone. See NOW Function.
  • TODAY - Generates valid Datetime for the current date in the specified time zone. See TODAY Function.
  • DATEDIF - Calculates the difference between two Datetime values based on a specific unit of measure. See DATEDIF Function.


The following table includes flight arrival information for Los Angeles International airport. 

123412/15/17 11:35
21222/15/17 11:58
51032/15/17 11:21
840142/15/17 12:08
9952/16/17 12:12
11662/16/17 13:32
87672/15/17 16:43
949482/15/17 21:00
10292/14/17 19:21
77102/16/17 12:31


You are interested in generating a status report on today's flights. To assist, you must generate columns with the current date and time values:

Tip: You should create separate columns containing static values for NOW and TODAY functions. Avoid creating multiple instances of each function in your dataset, as the values calculated in them can vary at execution time.

derive type:single value: NOW('America\/Los_Angeles') as: 'currentTime'

derive type:single value: TODAY('America\/Los_Angeles') as: 'currentDate'

Next, you want to identify the flights that are landing today. In this case, you can use the DATEDIF function to determine if the Arrival value matches the currentTime value within one day:

NOTE: The DATEDIF function computes difference based on the difference from the first date to the second date based on the unit of measure. So, a timestamp that is 23 hours difference from the base timestamp can be within the same unit of day, even though the dates may be different (2/15/2017 vs. 2/14/2017).

derive type:single value: datedif(currentDate, Arrival, day) as: 'today'

Since you are focusing on today only, you can remove all of the rows that do not apply to today:

delete row: today <> 0

Now focusing on today's dates, you can calculate the difference between the current time and the arrival time by the minute:

derive type:single value: datedif(currentTime, Arrival, minute) as: 'status'

Using the numeric values in the status column, you can compose the following transform, which identifies status of each flight:

set col: status value: if(status < -20, 'arrived', if(status > 20, 'scheduled', if(status <= 0, 'landed', 'arriving')))


You now have a daily flight status report:

2017-02-152017-02-15·11:46:12123412/15/17 11:35landed0
2017-02-152017-02-15·11:46:1221222/15/17 11:58arriving0
2017-02-152017-02-15·11:46:1251032/15/17 11:21arrived0
2017-02-152017-02-15·11:46:12840142/15/17 12:08scheduled0
2017-02-152017-02-15·11:46:1287672/15/17 16:43scheduled0
2017-02-152017-02-15·11:46:12949482/15/17 21:00scheduled0
2017-02-152017-02-15·11:46:1210292/14/17 19:21arrived0

The currentDatecurrentTime, and today columns can be deleted.

See Also for TODAY Function:


This page has no comments.