Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
WANSANG
Contributor II
Contributor II

how to convert timestamp to integer?

Hi.  

In qlik sense, when using the num function, the timestamp is converted to a decimal point.

Even though I converted the timestamp format to date

example : Num(Date(now(),'YYYY-MM-DD'));

return  is "44475.719050926"

 

Not use Today(), only now() function that timestamp data type.

I want to convert timestamp to integer.

i want like below value.

"44475" 

how to convert timestamp to integer?

Is there a simple way?

 

 

 

Labels (4)
1 Solution

Accepted Solutions
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi, 

You can use floor() function.

E.g Floor(Num(Now()))

AshutoshBhumkar_0-1633508810669.png

 

 

Thanks,

Ashutosh

View solution in original post

5 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi, 

You can use floor() function.

E.g Floor(Num(Now()))

AshutoshBhumkar_0-1633508810669.png

 

 

Thanks,

Ashutosh

WANSANG
Contributor II
Contributor II
Author

Hi  Ashutosh.

floor function is very good way.

Let me ask you one more thing. 

Why do I change to date format, but there is a decimal point?

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

You mean, How do you change to date format ?

Apply Date() on top of it to get Date from the integer 

 

Date(Floor(Num(Now())))

WANSANG
Contributor II
Contributor II
Author

Hi, Ashutosh

I used the Num() function to convert, but the result is different.

Date(now(),'YYYY-MM-DD') , Date(Today(),'YYYY-MM-DD') is same result.

This result is "2021-10-07"

But, I use Num() function on the result, the return value is different.

Num(Date(now(),'YYYY-MM-DD')) is "44476.471875"

Num(Date(Today(),'YYYY-MM-DD')) is "44476"

I just curious about the result.

 

 

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Now() returns the date with timestamp and Today() returns the date only. Hence the difference in an integer with decimal for now()