Subscribe Bookmark RSS Feed

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.
3 REPLIES
thechadd

Community Trekker

Joined:

Jun 23, 2011

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

Joined:

Jun 23, 2011

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
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!