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 "0" for each digit.

To denote a possible digit, use the symbol "#". If the format contains only # symbols to the left of the decimal point and the numbers is less than 1, the zeros are trimmed and it will begin with a decimal point. If the format contains # symbols to the right of the decimal point, all values will be displayed.

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 "000000000000" (thousand separator="") could be used to display a twelvedigit part number as "001245678912".
Examples:
 # ##0: describes the number as an integer with a thousands separator.
 ###0: describes the number as an integer without a thousands separator.
 0000: describes the number as an integer with at least four digits. For example, the number 123 will be shown as 0123.
 0.000: describes the number with three decimals.
 0.0##: describes the number with three decimals. Some might be displayed as zeros.
Special number formats
QlikView 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 (bin) or (BIN). 
Octal format 
To indicate octal format the format code should start with (oct) or (OCT). 
Hexadecimal format 
To indicate hexadecimal format the format code should start with (hex) or (HEX). If the capitalized version is used AF will be used for formatting (for example 14FA). The noncapitalized version will result in formatting with af (for example 14fa). Interpretation will work for both variants regardless of the capitalization of the format code. 
Decimal format 
The use of (dec) or (DEC) to indicate decimal format is permitted but unnecessary. 
Custom radix format 
To indicate a format in any radix between 2 and 36 the format code should start with (rxx) or (Rxx) where xx is the twodigit number denoting the radix to be used. If the capitalized R is used letters in radices above 10 will be capitalized when QlikView is formatting (for example 14FA). The noncapitalized r will result in formatting with noncapital letters (for example 14fa). Interpretation will work for both variants regardless of the capitalization of the format code. Note that (r02) is the equivalent of (bin), (R16) is the equivalent of (HEX), and so on. 
Roman format 
To indicate roman numbers the format code should start with (rom) or (ROM). If the capitalized version is used capital letters will be used for formatting (for example MMXVI). The noncapitalized version will result in formatting with lower cap letters (mmxvi). Interpretation will work for both variants regardless of the capitalization of the format code. Roman numbers are generalized with minus sign for negative numbers and 0 for zero. Decimals are ignored with roman formatting. 
Examples:
 num(199, '(bin)') returns 11000111
 num(199, '(oct)') returns 307
 num(199, '(hex)') returns c7
 num(199, '(HEX)' ) returns C7
 num(199, '(r02)' ) returns 11000111
 num(199, '(r16)') returns c7
 num(199, '(R16)' ) returns C7
 num(199, '(R36)') returns 5J
 num(199, '(rom)') returns cxcix
 num(199, '(ROM)' ) returns CXCIX
Dates
You can use the following symbols to format a date. Arbitrary separators can be used.
Symbol  Description 

D 
To describe the day, use the symbol "D" for each digit. 
M 
To describe the month number, use the symbol "M".

Y 
To describe the year, use the symbol "Y" for each digit. 
W 
To describe the weekday, use the symbol "W".
DayNames and LongDayNames 
Examples: (with 31st March 2013 as example date)
 YYMMDD describes the date as 130331.
 YYYYMMDD describes the date as 20130331.
 YYYYMMMDD describes the date as 2013Mar31.
 DD MMMM YYYY describes the date as 31 March 2013.
 M/D/YY describes the date as 3/31/13.
 W YYMMDD describes the date as 6 130331.
 WWW YYMMDD describes the date as Sat 130331.
 WWWW YYMMDD describes the date as Saturday 130331.
Times
You can use the following symbols to format a time. Arbitrary separators can be used.
Symbol  Description 

h 
To describe the hours, use the symbol "h" for each digit. 
m 
To describe the minutes, use the symbol "m" for each digit. 
s 
To describe the seconds, use the symbol "s" for each digit. 
f  To describe the fractions of a second, use the symbol "f" for each digit. 
tt 
To describe the time in AM/PM format, use the symbol "tt" after the time. 
Examples: (with 18.30 as example time):
 hh:mm: describes the time as 18:30
 hh.mm.ss.ff: describes the time as 18.30.00.00
 hh:mm:tt: 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):
 YYMMDD hh:mm: describes the time stamp as 130331 18:30
 M/D/Y hh.mm.ss.ffff: describes the time stamp as 3/31/13 18.30.00.0000