- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
date format
Good morning,
I have a DB with two columns: input and output.
These columns are dates but are in the wrong format.
For example cell 14.45 corresponds to 2:45 p.m.
I tried by modifying the format of the column by saying that in input it was numeric format and in output I would like “h:m” as below:
This doesn't work, do you have any idea to solve this problem please?
Thank you for your answers !
This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: date format
Thank you for your answers !
This post originally written in French and has been translated for your convenience. When you reply, it will also be translated back to French .