Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Calculating difference between two dates and times in hours

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 14, 2014 7:21 AM
(10250 views)

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

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Same principle:

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

3 REPLIES 3

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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,

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Same principle:

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