Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Theresa
Level III

How to only keep "day" information in the column after to time doing subtraction calculation

 

Below scripts, can't only get "day" and do not show the "hr:m"; Is there a way only get the day information? Ignore the information"hr:m"?

 

Scripts:

New Column( "Required Period 3",
Numeric,
"Continuous",
Format( ":day:hr:m", 14 ),
Input Format( ":day:hr:m" ),
Formula( :Target Completion - :Target Start ),
Set Selected
),

 

Data table is below:

Day is the only what i want after complete-start.

 

 

start                   Complete         Duration=Complete-Start          Change format       Day is what i need

2019-04-16      2020-03-31        30240000                                  :350:00:00               350
2019-08-01      2019-12-31       13132800                                   :152:00:00               152

3 REPLIES 3
Highlighted
Thierry_S
Level VI

Re: How to only keep "day" information in the column after to time doing subtraction calculation

Hi,
Have tried the Date Difference function in which you can specify the increment (e.g. "day", "week"...)

 

Date Difference( 01Jan2010:00:00:00, 27Jul2010:21:21:57, "Day", "fractional" );
Thierry R. Sornasse
Highlighted
Theresa
Level III

Re: How to only keep "day" information in the column after to time doing subtraction calculation

thanks for reply. But sorry, a little confuse. If there is over 300 rows with dates information need do this calculation. I need to change the start and complete format, then use use below script?

I try below but didn't work

New Column( "Required Period",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Date Difference( :Complete - :Start ),
	"Day",
	"fractional"
);
Highlighted
Thierry_S
Level VI

Re: How to only keep "day" information in the column after to time doing subtraction calculation

Hi Theresa,

I don't have access to JMP right now but the interval "Day" should be within the Date Difference function
New Column( "Required Period",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula (Date Difference( :Start, :Complete, "Day", "fractional")),
);

Or something close to this
Thierry R. Sornasse
Article Labels

    There are no labels assigned to this post.