Conventions for number and time formats
In many interpretation and formatting functions it is possible to set the format for numbers and dates by using a format code. This topic describes the conventions used to format a number, date, time, or time stamp. These conventions apply both to script and chart functions.
Number formats
To denote
a specific number of digits, use the symbol
To denote
a possible digit to the left of the decimal point, use the symbol
To mark the position of the thousands separator or the decimal separator, use the applicable thousands separator and the decimal separator.
The format code is used for defining the positions of the separators. It is not possible to set the separator in the format code. Use the DecimalSep and ThousandSep variables for this in the script.
It is possible to use the
thousand separator to group digits by any number of positions, for example, a format
string of
For more information, see DecimalSep and ThousandSep .
Examples:
Number format | Description |
---|---|
|
describes the number as an integer with a thousands separator. In this example " " is used as a thousands separator. |
|
describes the number as an integer without a thousands separator. |
|
describes the number as an integer with at least four digits. For example, the number 123 will be shown as 0123. |
|
describes the number with three decimals. In this example "." is used as a decimal separator. |
Special number formats
Qlik Sense can interpret and format numbers in any radix between 2 and 36 including binary, octal and hexadecimal. It can also handle roman formats.
Format | Description |
---|---|
Binary format |
To indicate binary format
the format code should start with |
Octal format |
To indicate octal format
the format code should start with |
Hexadecimal format |
To indicate hexadecimal format
the format code should start with |
Decimal format |
The use of |
Custom radix format |
To indicate a format in
any radix between 2 and 36 the format code should start with |
Roman format |
To indicate roman numbers
the format code should start with |
Examples:
Example | Result |
---|---|
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
|
returns |
Dates
You can use the following symbols to format a date. Arbitrary separators can be used.
Symbols | Description |
---|---|
|
To describe
the day, use the symbol |
|
To describe
the month number, use the symbol Use
For more information, see MonthNames and LongMonthNames . |
|
To describe
the year, use the symbol |
|
To describe
the weekday, use the symbol
For more information, see DayNames and LongDayNames . |
Examples: (with 31st March 2013 as example date)
Example | Result |
---|---|
|
describes the date as 13-03-31. |
|
describes the date as 2013-03-31. |
|
describes the date as 2013-Mar-31. |
|
describes the date as 31 March 2013. |
|
describes the date as 3/31/13. |
|
describes the date as 6 13-03-31. |
|
describes the date as Sat 13-03-31. |
|
describes the date as Saturday 13-03-31. |
Times
You can use the following symbols to format a time. Arbitrary separators can be used.
Symbols | Description |
---|---|
|
To describe
the hours, use the symbol |
|
To describe
the minutes, use the symbol |
|
To describe
the seconds, use the symbol |
|
To describe
the fractions of a second, use the symbol |
|
To describe
the time in AM/PM format, use the symbol |
Examples: (with 18.30 as example time):
Example | Result |
---|---|
|
describes the time as 18:30 |
|
describes the time as 18.30.00.00 |
|
describes the time as 06:30:pm |
Time stamps
The same notation as that of dates and times above is used in time stamps.
Examples: (with 31th March 2013 18.30 as example time stamp):
Example | Result |
---|---|
|
describes the time stamp as 13-03-31 18:30. |
|
describes the time stamp as 3/31/13 18.30.00.0000. |