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

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Difference between two timestamps

I have 2 columns of timestamps(Date) till Milliseconds ( "yyyy-MM-dd'T'HH:mm:ss0683p000009M9p6.pngSS" format)

0683p000009M3C3.png

The Difference Output Should Be like : 0000-00-00 00:00:20:000

('Long' format is acceptable)

 

Thanks in advance.

 

Regards

Subhadeep

 

Labels (2)
3 Replies
vapukov
Master II
Master II

Hi

 

if (Long) acceptable, why do not use

TalendDate.diffDate(row1.strDate2,row1.strDate1,"SSS") 

return (Long) number of milliseconds between dates

 

then you could add code to convert milliseconds to years/month/etc  (if need)

Var.ms = TalendDate.diffDate(row1.strDate2,row1.strDate1,"SSS") 

output (for HH:mm:ss:SSS):
String.format("%02d:%02d:%02d.%d", (Var.ms / (1000 * 60 * 60)) % 24, (Var.ms / (1000 * 60)) % 60, (Var.ms / 1000) % 60, Var.ms % 1000) 

 

Anonymous
Not applicable
Author

Hi @vapukov

 

First of all ,thanks a lot for your reply.

I tried with the Milliseconds approach only .

But , I need the difference output in full timestamp format, Like :

yyyy-MM-dd HH:mm:ss0683p000009M9p6.pngSS

 

Looking forward to hear from you.

 

Regards 

Subhadeep