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 - System variables default
Overview
In this example, the dates in the dataset are set in the MM/DD/YYYY format.
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset with dates, which will be loaded into a table named, Transactions.
A date field.
The default DayNames definition.
Load script
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
Transactions:
LOAD
date,
WeekDay(date) as dayname,
id,
amount
INLINE
[
date,id,amount
01/01/2022,1,1000
02/01/2022,2,2123
03/01/2022,3,4124
04/01/2022,4,2431
];
Results
Load the data and open a sheet. Create a new table and add these fields as dimensions:
date
dayname
Create this measure:
sum(amount)
Results table
date
dayname
sum(amount)
01/01/2022
Sat
1000
02/01/2022
Tue
2123
03/01/2022
Tue
4124
04/01/2022
Fri
2431
In the load script, the WeekDay function is used with the date field as the provided argument. In the results table, the output of this WeekDay function displays the days of the week in the format of the DayNames definition.
Example 2 - Change system variable
Overview
Open the Data load editor and add the load script below to a new tab.
The same dataset and scenario from the first example are used.
However, at the start of the script, the DayNames definition is modified to use the abbreviated days of the week in Afrikaans.
Load script
SET DayNames='Ma;Di;Wo;Do;Vr;Sa;So';
Transactions:
Load
date,
WeekDay(date) as dayname,
id,
amount
Inline
[
date,id,amount
01/01/2022,1,1000
02/01/2022,2,2123
03/01/2022,3,4124
04/01/2022,4,2431
];
Results
Load the data and open a sheet. Create a new table and add these fields as dimensions:
date
dayname
Create this measure:
sum(amount)
Results table
date
dayname
sum(amount)
01/01/2022
Sa
1000
02/01/2022
Di
2123
03/01/2022
Di
4124
04/01/2022
Vr
2431
In the results table, the output of this WeekDay function displays the days of the week in the format of the DayNames definition.
It is important to remember that if the language for the DayNames is modified like it has been in this example, the LongDayNames would still contain the days of the week in English. This would need to be modified as well if both variables are used in the application.
Example 3 – Date function
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
A dataset with dates, which will be loaded into a table named, Transactions.
A date field.
The default DayNames definition.
Load script
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
Transactions:
Load
date,
Date(date,'WWW') as dayname,
id,
amount
Inline
[
date,id,amount
01/01/2022,1,1000
02/01/2022,2,2123
03/01/2022,3,4124
04/01/2022,4,2431
];
Results
Load the data and open a sheet. Create a new table and add these fields as dimensions:
date
dayname
Create this measure:
sum(amount)
Results table
date
dayname
sum(amount)
01/01/2022
Sat
1000
02/01/2022
Tue
2123
03/01/2022
Tue
4124
04/01/2022
Fri
2431
The default DayNamesdefinition is used. In the load script, the Date function is used with the date field as the first argument. The second argument is WWW. This formatting converts the result into the values stored in the DayNames definition. This is displayed in the output of the results table.
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!