The format defined replaces the long weekday names convention in the regional settings.
Syntax:
LongDayNames
The following example of the LongDayNames function defines day names in full:
Set
LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';
When modifying the variable, a semicolon ; is required to separate the individual values.
The LongDayNames function can be used in combination with the Date - script and chart function function which returns DayNames as field values.
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.
Example 1 - System variable default
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 LongDayNames definition.
Load script
SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';
Transactions:
LOAD
date,
Date(date,'WWWW') 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
Saturday
1000
02/01/2022
Tuesday
2123
03/01/2022
Tuesday
4124
04/01/2022
Friday
2431
In the load script, to create a field called, dayname, the Date function is used with the date field as the first argument. The second argument in the function is the formatting WWWW.
Using this formatting converts the values from the first argument into the corresponding full day name that is set in the variable LongDayNames. In the results table, the field values of our created field dayname display this.
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 LongDayNames definition is modified to use the days of the week in Spanish.
Load Script
SET LongDayNames='Lunes;Martes;Miércoles;Jueves;Viernes;Sábado;Domingo';
Transactions:
LOAD
date,
Date(date,'WWWW') 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
Sábado
1000
02/01/2022
Martes
2123
03/01/2022
Martes
4124
04/01/2022
Viernes
2431
In the load script, the LongDayNames variable is modified to list the days of the week in Spanish.
Then, you create a field called, dayname, which is the Date function used with the date field as the first argument.
The second argument in the function is the formatting WWWW. By using this formatting Qlik Sense converts the values from the first argument into the corresponding full day name set in the variable LongDayNames.
In the results table, the field values of our created field dayname displays the days of the week written in Spanish and in full.
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!