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

How do i get a timestamp difference in number of days and time?

Hi!

How do I get the timestamp difference in days and time?

When i do below expression, it's giving me a result in decimal (eg. 4.041).

Timestamp#(Timestamp#(LastMod)-Timestamp#(Change)).

I want this the result as follows:

Change                                              LastMod                            Result should be

6/1/2016  12:24:00 AM                  6/5/2016 1:24:00 PM             "4 days" and however many hh:mm:ss left

Thanks in advance for your help!

4 Replies
sunny_talwar

May be this

Floor(LastMod) - Floor(Change)

Anonymous
Not applicable

perhaps

=floor(LastMod-Change)&' days and however many '& timestamp(mod(LastMod-Change,1),'hh:mm:ss')&' left'

xarapre7
Creator II
Creator II
Author

I modified it a little bit as below:

=floor(LastMod-Change)&' days & '& =time(frac(Change) - frac(LastMod), 'hh:mm:ss')&' hh:mm:ss left'

Thank you Sunny And Robin!

oscar_ortiz
Partner - Specialist
Partner - Specialist

You can try something like this in the script:

T1:

LOAD * INLINE [

    Change, LastMod

    6/1/2016 12:24:00 AM, 6/5/2016 1:24:00 PM

];

T2:

LOAD

Timestamp#(Change, 'M/D/YYYY hh:mm:ss TT') as ChangeTimeStamp,

Timestamp#(LastMod, 'M/D/YYYY hh:mm:ss TT') as LastModTimeStamp,

Interval( Timestamp#(LastMod, 'M/D/YYYY hh:mm:ss TT') - Timestamp#(Change, 'M/D/YYYY hh:mm:ss TT'), 'dd-hh:mm' ) as Result

Resident

T1

;

267438.PNG

Good Luck

Oscar