Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script to subtract time between 2 columns

Hi, how do I find the difference in time between 2 columns 'Date Created' and 'Date Confirmed' and display the difference in mins? Thanks.

11 Replies
ashfaq_haseeb
Champion III
Champion III

Hi,

Try below

Interval( Date('2010-11-19 09:22:09.000') - Date( '2010-11-19 11:52:38.000'), 'hh:mm:ss')

Interval( Date('19:43') - Date( '12:56'), 'hh:mm:ss')

If you need in minute then try below.

time(frac(date2) - frac(date1))

Regards

ASHFAQ

Anonymous
Not applicable
Author

Try this:

Timestamp#(Timestamp#([Fieldname1])-Timestamp#([Fieldname2]))

nlmmaurya
Contributor II
Contributor II

Hi,

Try this:

Interval(([Date Confirmed]- [Date Created]),'mm:ss')

Regards,

Neelam

crusader_
Partner - Specialist
Partner - Specialist

Hi,

Try this one:

Interval([Date Confirmed]-[Date Created])

HTH

Andrei

Not applicable
Author

I cannot use specific time as I want to find the time difference for all the times between the 2 mentioned fields. Thanks.

Not applicable
Author

Thanks, but I got negative minutes until a thousand over for example '-1034'

Not applicable
Author

Thanks, but why do I have negative timings now.

crusader_
Partner - Specialist
Partner - Specialist

Are you sure that [Date Created] less than [Date Confirmed] ?

Cause you shouldn't get negative results

Andrei

Not applicable
Author

Hi Rachel,

Can you attach a sample of your data, as in one of my apps I use the below and i have accurate results:

num#(Interval(SESSION_DATEFIN - SESSION_DATEDEB, 'ss')) / 3600 as TimeInHr,

num#(Interval(SESSION_DATEFIN - SESSION_DATEDEB, 'ss')) / 60 as TimeInMin,

num#(Interval(SESSION_DATEFIN - SESSION_DATEDEB, 'ss')) as TimeInSec