cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • See how to use the JMP Marketplace – Free tools to expand JMP capabilities. Register. July 10, 2 pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
fr2007
Level II

Calculating difference between two dates and times in hours

Iam trying to subtract two dates and times and get the answer in hours. For example

     Column1                   Column2

01/30/2013 5:30       02/02/2013   14:30

I want to subtract column1 from column2 and the difference in hours. I want to do this in JSL Scripting language... Can some one help how to subtract the above two dates..I mean the formula for doing that,.

Thanks a lot


1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Calculating difference between two dates and times in hours

Same principle:

((:Column 4 + :Column 3) - (:Column 1 + :Column 2)) / 60 / 60

View solution in original post

3 REPLIES 3
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Calculating difference between two dates and times in hours

The date/time value internally represents nr of seconds since a reference date. Simply substract the the columns and divide with 3600 to get the result in hours.

(:Column2-Column1)/60/60

fr2007
Level II

Re: Calculating difference between two dates and times in hours

But the Date is one column and Time is in another column. Sorry, I represented my data wrong in the above example. It actually looks like

  Column1           Column2               Column3                  Column4

01/30/2013              5:30                 02/02/2013              14:30

here column1 and column 2 is one set . Example, jan 30th 5:30 AM is represented by column 1 and column 2.

Feb 2nd 14:30 PM is represented by column 3 and column 4. Now I want to know how many hours are in between Feb 2nd 14:30 PM and Jan 30 5:30 AM.

Thanks,

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Calculating difference between two dates and times in hours

Same principle:

((:Column 4 + :Column 3) - (:Column 1 + :Column 2)) / 60 / 60

Recommended Articles