Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

What si the use of Num() ?

Hey,

Can anyone tell me the use of NUM() ?

Thanks

13 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Date(Floor(Num(Logdatetime)), 'MM/DD/YYYY')

Num() is redundant here - it is a formatting command, so it does nothing in this case as the Date() format will override the Num() format.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MayilVahanan

Hi

Try like this

=Date(Floor(Timestamp#('31/03/2015 10:10:50 am','DD/MM/YYYY hh:mm:ss tt')), 'MM/DD/YYYY')

=Date(Floor(Timestamp#(Logdatetime,'DD/MM/YYYY hh:mm:ss tt')), 'MM/DD/YYYY')


if its already dateformat, use Timestamp instead of Timestamp#.

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If it's not really a question about Num(), you may try:

=DayStart(Logdatetime)

Does everything in a single step.

If your input date format doesn't follow the default pattern for timestamps (and as a result QV reads values in the wrong order, or simply doesn't "get it"), then use

=DayStart(Date#(Logdatetime, 'DD/MM/YYYY hh:mm'))

or use a format that better matches the input data.

If the output of DateStart isn't formatted like you want it to be, use

=Date(DayStart(Date#(Logdatetime, 'DD/MM/YYYY hh:mm')), 'YYYY@MM@DD')


or use any other format.


Note that the time(), date() and timestamp() functions all do more or less the same thing. They only differ in their choice of default format if you omit the second parameter.


And as an added bonus:

Date(date, formatpattern) associates a new format string with the numerical value in date. It does not change that numerical value in any way.

Date#(date, formatstring) tries to deduce a date value from the first parameter by matching the format string from the second parameter with the date value. If that works, a numerical value with a date format string will be the result. If it doesn't, you'll get NULL.


Best,


Peter.

ToniKautto
Employee
Employee

Have you tried applying the examples from the manual?

If NO, please try it so that you can see what happens and learn from the output.

When you have tried it, what specifically is it that is unclear?