Skip to main 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. 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.

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