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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
yoganantha321
Creator II
Creator II

Timestamp difference

I have two timestamp fields JOB_CREATE and  JOB_ONSITETIME

Screenshot_85.png Screenshot_86.png

in the script, I need to calculate a new field JOB_RESPONSE  in minutes  calculated using JOB_ONSITETIME - JOB_CREATE

for eg: 12/29/2016 00:12:20 - 12/29/2016 00:12:16   = 0.04 SECONDS   CONVERT TO MINUTE AS 00

I have used the following in script and got the output as:

Num(Timestamp(JOB_ONSITETIME,'MM/DD/YYYY HH:MM:SS')-Timestamp(JOB_CREATETIME,'MM/DD/YYYY HH:MM:SS'))  as JOB_RESPTIME

Output as:

Screenshot_87.png

which must be 0.04

I need to develop in the script wise, can anyone help me,

regards,

Yoganantha Prakash G P

Labels (1)
3 Replies
Anil_Babu_Samineni
MVP
MVP

May be use this?

Hour(Timestamp(JOB_ONSITETIME,'MM/DD/YYYY HH:MM:SS')-Timestamp(JOB_CREATETIME,'MM/DD/YYYY HH:MM:SS'))

OR

Inteval(Timestamp(JOB_ONSITETIME,'MM/DD/YYYY HH:MM:SS')-Timestamp(JOB_CREATETIME,'MM/DD/YYYY HH:MM:SS'),'HH')

OR

Time(Timestamp(JOB_ONSITETIME,'MM/DD/YYYY HH:MM:SS')-Timestamp(JOB_CREATETIME,'MM/DD/YYYY HH:MM:SS'),'HH')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable

Try This one.

   INTERVAL(JOB_ONSITETIME - JOB_CREATE,'SEC')

MarcoWedel
MVP
MVP

Hi,

maybe like this?

QlikCommunity_Thread_266016_Pic1.JPG

LOAD *,

     Interval(JOB_ONSITETIME-JOB_CREATETIME, 'm.ss') as JOB_RESPTIME

INLINE [

    JOB_CREATETIME, JOB_ONSITETIME

    12/29/2016 00:12:16, 12/29/2016 00:12:20

];

hope this helps

regards

Marco