cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
louiefb
Level II

Display Numeric-Date column as "d/m/y h:m:s"?

Hello,

 

I have a date-time column that I want to display as "d/m/y h:m:s", yet retain its Numeric-Date data type (as in the right table of the figure):

 

time-character_vs_numeric.JPG

 

I have the following:

 

:"Time" << Data Type(Numeric);
:"Time" << Set Modeling Type(Continuous);
:"Time" << Set Format(Format("m/d/y h:m:s", 23));

 

But it instead converts the column onto Unix time format. How do I get this done through JSL?

 

Thanks,

Louie

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Display Numeric-Date column as "d/m/y h:m:s"?

The issue you are having, is that you are attempting to specify the format incorrectly.  The Format() function always returns a character string.  Take a look in the Scripting Index for examples on how to use the Format() function.

The JSL below will convert a Character column with the data formatted as

     08/21/2020 11:17:31

and convert it into a JMP Date/Time column

:Time << Data Type( Numeric );
:Time << Set Modeling Type( Continuous );
:Time << Input Format( "m/d/y h:m:s" );
:Time << Format( "m/d/y h:m:s", 23 );
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Display Numeric-Date column as "d/m/y h:m:s"?

The issue you are having, is that you are attempting to specify the format incorrectly.  The Format() function always returns a character string.  Take a look in the Scripting Index for examples on how to use the Format() function.

The JSL below will convert a Character column with the data formatted as

     08/21/2020 11:17:31

and convert it into a JMP Date/Time column

:Time << Data Type( Numeric );
:Time << Set Modeling Type( Continuous );
:Time << Input Format( "m/d/y h:m:s" );
:Time << Format( "m/d/y h:m:s", 23 );
Jim