Skip to main content

today - script and chart function

This function returns the current date. The function returns values in the DateFormat system variable format.

Syntax:  

today([ timer_mode])

Return data type: dual

The today() function can be used either in the load script or in chart objects.

The default timer_mode value is 1.

Arguments
Argument Description
timer_mode

Can have the following values:

0 (day of last finished data load)
1 (day of function call)
2 (day when the app was opened)

Information noteIf you use the function in a load script, timer_mode=0 will result in the day of the last finished data load, while timer_mode=1 will give the day of the current data load.
Function examples
timer_mode value Result if used in load script Result if used in chart object
0 Returns a date, in the DateFormat system variable format, of the last successful data reload prior to the latest data reload. Returns a date, in the DateFormat system variable format, for the latest data reload.

1

Returns a date, in the DateFormat system variable format, for the latest data reload. Returns a date, in the DateFormat system variable format, of the function call.

2

Returns a date, in the DateFormat system variable format, for when the user’s session in the application began. This will not be updated unless the user reloads the script. Returns the date, in the DateFormat system variable format, for when the user’s session in the application began. This will be refreshed once a new session begins or the data in the application is reloaded.

When to use it

The today() function is commonly used as a component within an expression. For example, it can be used to calculate the interest that has accumulated in a month up to the current date.

The following table provides an explanation of the result returned by the today() function, given different values for the timer_mode argument:

Regional settings

Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples. For more information, see Modifying app regional settings.

Default regional settings in apps are based on a combination of identity provider settings, system settings, or browser settings. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.

If you are an app creator, you can set the default region for apps you create. For more information, see Setting your preferred regional settings for creating apps.

Example 1 – Generation of objects using load script

Example 2 – Generation of objects without load script

Example 3 – Scenario