How to convert 24 Hour into 12 Hour with AM/PM?Hi Community,
I have data table with column TimeStamp 2023_10_04 02:22:24. Right now i already split the date & time into separate column using this script below:
Names Default To Here( 1 );
dt = Current Data Table();
dt << Text To Columns( delimiter( " " ), columns( :TimeStamp ) ); // in delimiter is SPACE
// Close the original timestamp column
dt << Delete Columns( "TimeStamp" );
dt << Delete Columns( "TimeStamp 1" );
But the format column still in 24 hour

I want format 12 hour like this

The problem is i have to use text to columns in excel if i want format 12 hour.
Can you please write me a script that can change all the row in columns into 12 hour format?
Automation and ScriptingRe: How to convert 24 Hour into 12 Hour with AM/PM?You could try using Format Pattern to create correct format for you. You can find it from column properties


Re: How to convert 24 Hour into 12 Hour with AM/PM?Hi jthi,
I try to change into format 12 in column properties

Turns out my time change into dot

Please help,
Re: How to convert 24 Hour into 12 Hour with AM/PM?Try out the different options that Format Pattern provides you with (it has explanation what each different option does).

Re: How to convert 24 Hour into 12 Hour with AM/PM?Re: How to convert 24 Hour into 12 Hour with AM/PM?JMP's date-time values are numbers of seconds. The format determines how the number is displayed, but does not change the underlying numeric data stored in the data table.
Re: How to convert 24 Hour into 12 Hour with AM/PM?The timestamp2 column contained character data before conversion. You'll need to convert it to numeric date-time data first by choosing both numeric and the proper format at the same time from the dialog. After that, you can change the format to have am/pm.
Re: How to convert 24 Hour into 12 Hour with AM/PM?That will happen if your current column is character and you try to directly change to numeric with your output format pattern. First, change the data type to numeric and apply the change. All the values should become large whole numbers. Then, set the format pattern as you did before.

Re: How to convert 24 Hour into 12 Hour with AM/PM?You might want to back up and not split the character data at all, just convert the original character time stamps into JMP date-time values.
Re: How to convert 24 Hour into 12 Hour with AM/PM?Thankyou all, got it right now.
Best Regards,
mystylelife19