Skip to main content Skip to complementary content

now - script and chart function

This function returns a timestamp of the current time. The function returns values in the TimeStamp system variable format. The default timer_mode value is 1.

Syntax:  

now([ timer_mode])

Return data type: dual

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

Arguments
Argument Description
timer_mode

Can have the following values:

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

Information noteIf you use the function in a data load script, timer_mode=0 will result in the time of the last finished data load, while timer_mode=1 will give the time of the function call in the current data load.
Tip noteThe now() function has a high-performance impact, which might result in scrolling issues if the function is used within tables' expressions. Whenever its use is not strictly necessary, we recommend using the today() function instead. If the use of now() is required in a layout, we recommend using the non-default settings now(0) or now(2) when possible, as they do not require constant recalculations

When to use it

The now() function is commonly used as a component within an expression. For example, it can be used to calculate the time remaining in a product's lifecycle. The now() function would be used instead of the today() function when the expression requires the use of a fraction of a day.

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

Function examples
timer_mode value Result if used in load script Result if used in chart object
0 Returns a timestamp, in the TimeStamp system variable format, of the last successful data reload prior to the latest data reload. Returns a timestamp, in the TimeStamp system variable format, for the latest data reload.

1

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

2

Returns a timestamp, in the TimeStamp 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 timestamp, in the TimeStamp 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.

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.

Default regional settings in apps are based on the regional system settings of the computer or server where Qlik Sense is installed. If the Qlik Sense server you are accessing is set to Sweden, the Data load editor will use Swedish regional settings for dates, time, and currency. These regional format settings are not related to the language displayed in the Qlik Sense user interface. Qlik Sense will be displayed in the same language as the browser you are using.

Example 1 – Generation of objects using load script

Example 2 – Generation of objects without load script

Example 3 – Scenario

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!