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]])

Return data type: dual

Arguments:  

DayEnd 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 days not starting at midnight, indicate an offset as a fraction of a day in day_start. For example, 0.125 to denote 3 AM.

Examples and results:  

These examples use the date format DD/MM/YYYY. The date format is specified in the SET DateFormat statement at the top of your load script. Change the format in the examples to suit your requirements.

Example 1:  

dayend('25/01/2013 16:45:00')

Returns 25/01/2013 23:59:59.

Example 2:  

dayend('25/01/2013 16:45:00', -1)

Returns '24/01/2013 23:59:59.

Example 3:  

dayend('25/01/2013 16:45:00', 0, 0.5)

Returns 26/01/2013 11:59:59.

Example 4:  

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.

This example finds the timestamp that marks the end of the day after each invoice date in the table.

TempTable:

LOAD RecNo() as InvID, * Inline [

InvDate

28/03/2012

10/12/2012

5/2/2013

31/3/2013

19/5/2013

15/9/2013

11/12/2013

2/3/2014

14/5/2014

13/6/2014

7/7/2014

4/8/2014

];

 

InvoiceData:

LOAD *,

DayEnd(InvDate, 1) AS DEnd

Resident TempTable;

Drop table TempTable;

The resulting table contains the original dates and a column with the return value of the dayend() function. You can display the full timestamp by specifying the formatting in the chart properties.

Example 4 results
InvDate DEnd
28/03/2012 29/03/2012 23:59:59
10/12/2012 11/12/2012 23:59:59
5/2/2013 07/02/2013 23:59:59
31/3/2013 01/04/2013 23:59:59
19/5/2013 20/05/2013 23:59:59
15/9/2013 16/09/2013 23:59:59
11/12/2013 12/12/2013 23:59:59
2/3/2014 03/03/2014 23:59:59
14/5/2014 15/05/2014 23:59:59
13/6/2014 14/06/2014 23:59:59
7/7/2014 08/07/2014 23:59:59
4/8/2014 05/08/2014 23:59:59

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!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com