Derives the timestamp for the current time 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
TODAY functions. You should create a separate column containing these values.
- 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. Time values are returned in 24-hour time.
For more information on generating the date value only for today, see TODAY Function.
Output: Generates a column of values that contain the current timestamp in UTC time zone.
Example with Time Zone:
Output: Generates a column of values that contain the current timestamp based on the time in the Eastern U.S. time zone.
|str_timezone||N||string||String value for the time zone for which the timestamp 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.
|Required?||Data Type||Example Value|
Example - Flight Status report
This example illustrates how the
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.
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
TODAY functions. Avoid creating multiple instances of each function in your dataset, as the values calculated in them can vary at execution time.
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:
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 (
Since you are focusing on today only, you can remove all of the rows that do not apply to today:
Now focusing on today's dates, you can calculate the difference between the current time and the arrival time by the minute:
Using the numeric values in the
status column, you can compose the following transform, which identifies status of each flight:
You now have a daily flight status report:
today columns can be deleted.
This page has no comments.