Skip to main content Skip to complementary content

dayend - script and chart function

This function returns a value corresponding to a timestamp of the final millisecond of the day contained in time. The default output format will be the TimestampFormat set in the script.

Syntax:  

DayEnd(time[, [period_no[, day_start]])

The dayend() function is commonly used as part of an expression when the user would like the calculation to use the fraction of the day that has not yet occurred. For example, to calculate the total expenses still to be incurred during the day.

Return data type: dual

Arguments
Argument Description
time The timestamp to evaluate.
period_no period_no is an integer, or expression that resolves to an integer, where the value 0 indicates the day that contains time. Negative values in period_no indicate preceding days and positive values indicate succeeding days.
day_start To specify that days do not starting at midnight, indicate an offset as a fraction of a day in day_start. For example, 0.125 to denote 3:00 AM.

In other words, to create the offset, divide the start time by 24 hours. For example, for a day to begin at 7:00 AM, use the fraction 7/24.

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.

Function examples
Example Result
dayend('01/25/2013 16:45:00') Returns 01/25/2013 23:59:59. PM
dayend('01/25/2013 16:45:00', -1) Returns 01/24/2013 23:59:59. PM
dayend('01/25/2013 16:45:00', 0, 0.5) Returns 01/26/2013 11:59:59. PM

Example 1 - Basic script

Example 2 – period_no

Example 3 – day_start script

Example 4 – Chart example

Arguments
Argument Description
time The timestamp to evaluate.
period_no period_no is an integer, or expression that resolves to an integer, where the value 0 indicates the day that contains time. Negative values in period_no indicate preceding days and positive values indicate succeeding days.
day_start To specify that days do not starting at midnight, indicate an offset as a fraction of a day in day_start. For example, 0.125 to denote 3:00 AM.

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!