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.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install 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