cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

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