cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
hcarr01
Level VI

format date

Bonjour,

Je dispose d’une BD avec deux colonnes : entrée et sortie.
Ces colonnes sont des dates mais sont au mauvais format.

hcarr01_1-1694701647772.png


Par exemple la cellule 14,45 correspond à 14h45.

 

J’ai essayé en modifiant le format de la colonne en disant qu’en entrée il s’agissait de format numérique et en sortie je voudrais « h:m » comme ci dessous :

 

hcarr01_0-1694701578439.png

 

cela ne fonctionne pas, avez-vous une idée pour résoudre ce problème SVP ?

Merci pour vos réponses !

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: format date

The issue is that time in JMP is categorized as seconds. 14.45 is not in seconds, so you need to convert your numbers into seconds.

There is likely a more economical way to do this formula, but this one shows exactly what is going on.

Dan_Obermiller_0-1694704306809.png

 

The first part (before the + sign) takes the integer portion and converts to seconds. The second part will find the fraction of the entry, multiply by 100 to convert to an integer, divide by 60 to convert to a fraction of an hour. Then, the "In Hours" function will convert that to seconds.

Dan Obermiller

View solution in original post

txnelson
Super User

Re: format date

To add to @Dan_Obermiller response, the below script will make the changes-in-place for the entrée column;

Names Default To Here( 1 );
dt = Current Data Table();

For Each Row(
	:entrée = In Hours( Floor( :entrée ) )
	+In Hours(
		Modulo( :entrée, Floor( :entrée ) ) * (100
		 / 60)
	)
);
:entrée << Format( "h:m" );

txnelson_0-1694713320569.png

 

Jim

View solution in original post

3 REPLIES 3

Re: format date

The issue is that time in JMP is categorized as seconds. 14.45 is not in seconds, so you need to convert your numbers into seconds.

There is likely a more economical way to do this formula, but this one shows exactly what is going on.

Dan_Obermiller_0-1694704306809.png

 

The first part (before the + sign) takes the integer portion and converts to seconds. The second part will find the fraction of the entry, multiply by 100 to convert to an integer, divide by 60 to convert to a fraction of an hour. Then, the "In Hours" function will convert that to seconds.

Dan Obermiller
txnelson
Super User

Re: format date

To add to @Dan_Obermiller response, the below script will make the changes-in-place for the entrée column;

Names Default To Here( 1 );
dt = Current Data Table();

For Each Row(
	:entrée = In Hours( Floor( :entrée ) )
	+In Hours(
		Modulo( :entrée, Floor( :entrée ) ) * (100
		 / 60)
	)
);
:entrée << Format( "h:m" );

txnelson_0-1694713320569.png

 

Jim
hcarr01
Level VI

Re: format date

merci pour vos réponses !