cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Pro extension simulates Bayesian Optimization runs. Prediction formulas stand in for experimental results. Run simulations and compare results. Download and use the extension.

Discussions

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

Subtract 1 hour from 00:00 time so that the Date could also be changed

Hello JMP community,

Is there any way to subtract 1 hour from 00:00 time so that the Date could also be converted to the previous data? 

 

For example:

        The input table is                                          Expected Output should be 

 

chandankishor66_0-1670734031752.png               chandankishor66_1-1670734069822.png     

 

Any suggestions would be highly appreciated.

Regards

 

 

1 REPLY 1
txnelson
Super User

Re: Subtract 1 hour from 00:00 time so that the Date could also be changed

Here is how I would do it

txnelson_0-1670763702979.png

Names Default To Here( 1 );
dt = Current Data Table();
For Each Row(
	datetime = :date + 60 * 60 * Hour( :time ) + 60 * Minute( :time );
	datetime = datetime - In Hours( 1 );
	:new time = Hour( datetime ) * 60 * 60 + Minute( datetime ) * 60;
	:new date = Date MDY( Month( datetime ), Day( datetime ), Year( datetime ) );
);

 

Jim

Recommended Articles