cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
dn610
Level III

Changing Date Format from Nominal to Numerical Data

Hi, I would like to change the below date field, which is a nominal field, to m/d/y format in jsl. Please help. 

 

dn610_0-1732151877399.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Changing Date Format from Nominal to Numerical Data

Create a new numeric column

In the Col Info dialog window, set the format to m/d/y

Set a formula for the column of

Informat( :Day of Process Date, "Format Pattern", "<Month> <D>,  <YYYY>" )

txnelson_0-1732157625331.png

Here is a script that when run creates the above example data table

New Table( "Format Pattern",
	Add Rows( 1 ),
	New Column( "Day of Process Date",
		Character,
		"Nominal",
		Set Values( {"November 8, 2024"} )
	),
	New Column( "New date",
		Numeric,
		"Nominal",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Formula(
			Informat(
				:Day of Process Date,
				"Format Pattern",
				"<Month> <D>,  <YYYY>"
			)
		)
	)
)

 

Jim

View solution in original post

txnelson
Super User

Re: Changing Date Format from Nominal to Numerical Data

Format Pattern was released in JMP 16 so that is why the formula does not work.  Here is a formula that works in JMP 15

If( Row() == 1,
	monthList = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
	}
);
Date MDY(
	Contains( monthList, Word( 1, :Day of Process Date, ", " ) ),
	Num( Word( 2, :Day of Process Date, ", " ) ),
	Num( Word( 3, :Day of Process Date, ", " ) )
);
Jim

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Changing Date Format from Nominal to Numerical Data

Create a new numeric column

In the Col Info dialog window, set the format to m/d/y

Set a formula for the column of

Informat( :Day of Process Date, "Format Pattern", "<Month> <D>,  <YYYY>" )

txnelson_0-1732157625331.png

Here is a script that when run creates the above example data table

New Table( "Format Pattern",
	Add Rows( 1 ),
	New Column( "Day of Process Date",
		Character,
		"Nominal",
		Set Values( {"November 8, 2024"} )
	),
	New Column( "New date",
		Numeric,
		"Nominal",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Formula(
			Informat(
				:Day of Process Date,
				"Format Pattern",
				"<Month> <D>,  <YYYY>"
			)
		)
	)
)

 

Jim
dn610
Level III

Re: Changing Date Format from Nominal to Numerical Data

When I tried to run the sample script above, the New date column doesn't populate for me. I also tried doing adding the formula manually, and it still doesn't work.

dn610_0-1732160983863.png

 

txnelson
Super User

Re: Changing Date Format from Nominal to Numerical Data

What version of JMP are you using and on what operating system.

I ran the code on both JMPPro 18 and JMPPro 16 on a Windows 11 and it ran without an issue.

 

Do you have any messages in the log?

Jim
dn610
Level III

Re: Changing Date Format from Nominal to Numerical Data

No error message. I have JMP 15 and windows 10.

txnelson
Super User

Re: Changing Date Format from Nominal to Numerical Data

Format Pattern was released in JMP 16 so that is why the formula does not work.  Here is a formula that works in JMP 15

If( Row() == 1,
	monthList = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
	}
);
Date MDY(
	Contains( monthList, Word( 1, :Day of Process Date, ", " ) ),
	Num( Word( 2, :Day of Process Date, ", " ) ),
	Num( Word( 3, :Day of Process Date, ", " ) )
);
Jim
dn610
Level III

Re: Changing Date Format from Nominal to Numerical Data

Thank you!