Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

num,num#?

hi expertsm

i want see the difference for 

NUM

NUM#

TIMESTAMP

TIMESTAMP#

WITH EXAMPLES ,PLS DON'T SHARE ANY JUST EXPLAIN ME HERE WITH SMALL EXAMPLES

THANKS IN ADVANCE

5 Replies
SergeyMak
Partner Ambassador
Partner Ambassador

Hi,

Information form help with examples:

Num

num(expression [ , format-code [ , decimal-sep [ , thousands-sep ] ] ] )

The num function formats the expression numerically according to the string given as format-code. Decimal separator and thousands separator can be set as third and fourth parameters. If the parameters 2-4 are omitted, the number format settings that have been specified with the are used in first hand, in second hand the operating system number format settings are used if number interpretation variables have not been set.

Example:

The examples below assume the two following settings:

Default setting 1

Default setting 2

Number format

# ##0,#

#,##0.#

num( A, '0.0' ) where A=35648.375 returns:

Setting 1

Setting 2

String

35 648 375

35648.375

Number

35648375

35648.375

num( A, '#,##0.##', '.' , ',' ) where A=35648 returns:

Setting 1

Setting 2

String

35,648.00

35,648.00

Number

35648

35648

num( pi( ), '0,00' ) returns:

Setting 1

Setting 2

String

3,14

003

Number

3.141592653

3.141592653


Num#

num#(expression [ , format-code[ , decimal-sep [ , thousands-sep] ] ])

The num# function evaluates the expression numerically according to the string given as format-code. Decimal separator and thousands separator can be set as third and fourth parameters. If the parameters 2-4 are omitted, the default number format set by script variables or in the operating system is used.

Examples:

The examples below assume the two following operating system settings:

Default setting 1

Default setting 2

Number format

# ##0,#

#,##0.#

num#( A, '#' ) where A=35,648.375 returns:

Setting 1

Setting 2

String

35,648.375

35648.375

Number

-

35648.375

num#( A, '#.#', '.' , ',') where A=35,648.375 returns:

Setting 1

Setting 2

String

35,648.375

35,648.375

Number

35648.375

35648.375

num#( A, '#.#',',','.' ) where A=35648.375 returns:

Setting 1

Setting 2

String

35648.375

35648.375

Number

35648375

35648375

num#( A, 'abc#,#' ) where A=abc123,4 returns:

Setting 1

Setting 2

String

abc123,4

abc123,4

Number

123.4

1234

Timestamp

timestamp(expression [ , format-code ])

The timestamp function formats the expression as a date and time according to the string given as format-code. If the format code is omitted, the date and time formats set in the operating system are used.

Examples:

The examples below assume the two following operating system settings:

Default setting 1

Default setting 2

Date format

YY-MM-DD

M/D/YY

Time format

hh:mm:ss

hh:mm:ss

timestamp( A ) where A=35648.375 returns:

Setting 1

Setting 2

String

97-08-06 09:00:00

8/6/97 09:00:00

Number

35648.375

35648.375

timestamp( A,'YYYY-MM-DD hh.mm') where A=35648 returns:

Setting 1

Setting 2

String

1997-08-06 00.00

1997-08-06 00.00

Number

35648

35648

Timestamp#

timestamp#(expression [ , format-code ])

The timestamp# function evaluates the expression as a date and time according to the string given as format-code. If the format code is omitted, the default date and time formats set in the operating system are used.

Examples:

The examples below assume the two following operating system settings:

Default setting 1

Default setting 2

Date format

YY-MM-DD

M/D/YY

Time format

hh:mm:ss

hh:mm:ss

timestamp#( A ) where A=8/6/97 09:00:00 returns:

Setting 1

Setting 2

String

8/6/97 09:00:00

8/6/97 09:00:00

Number

-

35648.375

timestamp#( A, 'YYYY-MM-DD hh_mm' ) where A=8/6/97 09_00 returns:

Setting 1

Setting 2

String

1997-08-06 09_00

1997-08-06 09_00

Number

35648.375

35648.375

It's also common to use Date(Date#()) in load script  to redefine your date representation. Something like

The example of value in your date field is 01-2014-31

Date(Date#(DateField, 'MM-YYYY-DD'), 'DD/MM/YYYY')

and after it will be represented as 31/01/2014

Regards,

Sergey

Regards,
Sergey
Anonymous
Not applicable
Author

Hi

i have seen this from help

pls give other examples

SergeyMak
Partner Ambassador
Partner Ambassador

An example how to use it with dates:

It's also common to use Date(Date#()) in load script  to redefine your date representation. Something like

The example of value in your date field is 01-2014-31

Date(Date#(DateField, 'MM-YYYY-DD'), 'DD/MM/YYYY')

and after it will be represented as 31/01/2014

Regards,

Sergey

Regards,
Sergey
jagan
Luminary Alumni
Luminary Alumni

Hi,

Date# is used to convert the given string date to the date format, i.e,

Example:

Date#('12-Nov-2014', 'CurrentDateFormat')

Date#('12-Nov-2014', 'DD-MMM-YYYY') - Now this converts '12-Nov-2014' to Qlikview readable date format.

Now using Date() we can change the format of the output date to be displayed

Example:

Date(DateFieldName, 'OutputDateFormat')

Date('11/12/2014', 'DD-MM-YY') will be displayed as 12-11-14

Sometimes we use the combination of Date#() and Date(), both conversion and formatting in a single step

Date(Date#('12-Nov-2014', 'DD-MMM-YYYY'), 'MM/DD/YY') - Output is 11/12/14

Similarly the TimeStamp() and TimeStamp#() works.

Hope this helps you.

Regards,

Jagan.

ashfaq_haseeb
Champion III
Champion III

Hi,

Check this

Difference between # and normal functions

Regards

ASHFAQ