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.
Argument | Description |
---|---|
timer_mode |
Can have the following values: 0 (time
at last finished data load) 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.
|
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:
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.