cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar

difference between times

I have multiple columns of date/time data in YYYY-MM-DD HH:MM:SS format. I would like to calculate the difference in time, e.g. in minutes, between two of the columns. Does anyone have a quick way to do this? I've tried a few things with no luck. Thanks.
1 ACCEPTED SOLUTION

Accepted Solutions

Re: difference between times

Thanks. I figured it out. One of my problems was the seconds actually also had tenths of seconds and couldn't be interpreted in a standard numeric format. So what I ended up doing was using "munger" to remove those tenths (while it was still a character field), then using "num" to convert it to numeric data, then formating it as continuous datetime data, and then doing the subtraction. Not sure if that's the easiest way but it worked!

View solution in original post

3 REPLIES 3

Re: difference between times

Are the columns already being interpreted by JMP as numeric continuous datetimes? If so, you can just subtract the two, and it will give you the result in seconds. Then you can just divide to get min,hour, etc..
ms
Super User (Alumni) ms
Super User (Alumni)

Re: difference between times

Try the formula


(:Time2 - :Time1) / 60


where :Time1 and :Time2 are the two date/time columns. Time in JMP is represented by the number of seconds since a reference date and hence dividing by 60 gives the difference in minutes.

The Chadd was faster...


Message was edited by: MS

Re: difference between times

Thanks. I figured it out. One of my problems was the seconds actually also had tenths of seconds and couldn't be interpreted in a standard numeric format. So what I ended up doing was using "munger" to remove those tenths (while it was still a character field), then using "num" to convert it to numeric data, then formating it as continuous datetime data, and then doing the subtraction. Not sure if that's the easiest way but it worked!