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

Could you help check this question, it is not got solved, thanks.

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"?  I use JMP12

 

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

 

 

Scripts don't work1:

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

 

Scripts don't work 2:

New Column( "Required Period",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Date Difference( :Target Completion - :Target Start ),
	"Day",
	"fractional"
);

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
txnelson
Super User

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

I suggest you use this JSL

New Table( "Untitled 2",
	Add Rows( 2 ),
	New Column( "Start",
		Numeric,
		"Continuous",
		Format( "yyyy-mm-dd", 12 ),
		Input Format( "yyyy-mm-dd" ),
		Set Selected,
		Set Values( [3638217600, 3647462400] )
	),
	New Column( "Complete",
		Numeric,
		"Continuous",
		Format( "y/m/d", 10 ),
		Input Format( "y/m/d" ),
		Set Values( [3668457600, 3660595200] )
	));
	New Column( "Day is what I need",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Date Difference( :Start, :Complete, "Day" ) )
	)
Jim

View solution in original post

Highlighted
Theresa
Level III

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

This works in JMP12; Thank you so much

 

New Column( "Required Period",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( Date Difference( :Target Start, :Target Completion, "Day" ) )
);

 

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

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

I suggest you use this JSL

New Table( "Untitled 2",
	Add Rows( 2 ),
	New Column( "Start",
		Numeric,
		"Continuous",
		Format( "yyyy-mm-dd", 12 ),
		Input Format( "yyyy-mm-dd" ),
		Set Selected,
		Set Values( [3638217600, 3647462400] )
	),
	New Column( "Complete",
		Numeric,
		"Continuous",
		Format( "y/m/d", 10 ),
		Input Format( "y/m/d" ),
		Set Values( [3668457600, 3660595200] )
	));
	New Column( "Day is what I need",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula( Date Difference( :Start, :Complete, "Day" ) )
	)
Jim

View solution in original post

Highlighted
Theresa
Level III

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

This works in JMP12; Thank you so much

 

New Column( "Required Period",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( Date Difference( :Target Start, :Target Completion, "Day" ) )
);

 

View solution in original post

Article Labels