cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Mart-in
Level III

Calcul duration between 2 dates

Hello,
My name is Martin, I’m french, so would you please forgive my english.

I start jmp and I’m no talented with logiciels and computers, but I am motived to progress.

My question is simple :

How can I create a new variable « duration » (in month) between the difference of two variables (date begin/date end) in dd/mm/yy.

Thank you for your comprehension.

Sincerely,
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Calcul duration between 2 dates

The result of the Date Difference() function, is not a JMP DateTime.  It is just the number of Months.  So you need to set the format for the Diff Date to "Best", not a JMP DateTime format.

Jim

View solution in original post

8 REPLIES 8
txnelson
Super User

Re: Calcul duration between 2 dates

Assuming your "date begin" and "date end" columns are valid JMP Date/Time values, then the new formula for calculating the difference is

Date Difference( :date begin, :date end, "month" )

Here is an image of the attached example data table that has the date begin and date end columns and a new column, Difference that uses the above formula

 dif1.PNG

If your date begin and date end are Character columns and not JMP Date/Time columns, you will need to convert them to Date/Time columns before being able to calculate the difference.  This can be done easily and has been covered multiple times in previous Discussion entries.

Jim
Jeff_Perkinson
Community Manager Community Manager

Re: Calcul duration between 2 dates

Good information about JMP date, time, datetime, and duration columns here:

 

Using dates, times, datetimes and durations in JMP 

-Jeff
Mart-in
Level III

Re: Calcul duration between 2 dates

Hello txnelson,

 

I don't understand, I can not suceed.

 

Would you like to see my data table ?

 

Thank you.

 

 

txnelson
Super User

Re: Calcul duration between 2 dates

I suspect that my Example data table confused the issue.  I have attached a new example data table.  It has 2 columns which represent the beginning date(date de début) and the ending date(date de fin).  I assume that you have a data table that has such columns.  All that needs to be done, is to then add a new column which in the example data table is called "Columne 3", which is the column that takes the beginning date and ending date columns and finds the difference.

Jim
Mart-in
Level III

Re: Calcul duration between 2 dates

Nelson,

 

First, I appreciate et thank you your answer.

 

I try but I don't understand where is my mistake. I know it is very very very simple as problem....

 

But I really want to progress with jmp.

 

Here muy example to corrige even if you could.

 

Best regards,

txnelson
Super User

Re: Calcul duration between 2 dates

The result of the Date Difference() function, is not a JMP DateTime.  It is just the number of Months.  So you need to set the format for the Diff Date to "Best", not a JMP DateTime format.

Jim
Mart-in
Level III

Re: Calcul duration between 2 dates

 Thank you so much to help me to progress.

 

Mart-in
Level III

Re: Calcul duration between 2 dates

Thanks to you two.
I really appreciate your help.
I will try it.
Sincerely,