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
Phil_Nash
Level II

Date Conversion issue

I have a set of data from a database that represents a date in an 8-number string "CreatedDateDimID" in the screen capture.  I need it to be formatted like the date in "SterlingDimDate.Date"

 

Date Conversion1.PNG

 

I tried converting to m/d/y in the column info, but it doesn't convert it correctly (see screen capture).  What am I missing?

 

Date Conversion2.PNG

 

Gives me this result when I would expect 01/03/2022 for the first one and 04/13/2022 for the second one;

 

Date Conversion3.PNG

 

I need to be able to capture the delta between the two dates.

 

Thanks!

-Phil

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Date Conversion issue

I think you might have to change the column to Character column, press apply (and possible even OK), then go back to column properties, set column to numeric continuous, set correct format and then press apply.

Numeric

jthi_0-1657554129538.png

Character

jthi_1-1657554141239.png

Back to numeric with formatting

jthi_2-1657554164361.png

 

 

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Date Conversion issue

I think you might have to change the column to Character column, press apply (and possible even OK), then go back to column properties, set column to numeric continuous, set correct format and then press apply.

Numeric

jthi_0-1657554129538.png

Character

jthi_1-1657554141239.png

Back to numeric with formatting

jthi_2-1657554164361.png

 

 

-Jarmo
Phil_Nash
Level II

Re: Date Conversion issue

Thanks! That worked perfectly.

Phil_Nash
Level II

Re: Date Conversion issue

I'm trying to build this into JSL and I can't seem to get the last step to work..

 

Date Conversion4.PNG

 

It doesn't seem to respect the Input Format.. I'm certain my code is wrong.

 

Date Conversion5.PNG

jthi
Super User

Re: Date Conversion issue

If I were to do this with scripting I would use different method. One option would be to use Informat:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(1),
	New Column("Col", Numeric, "Continuous", Format("Best", 12), Set Values([20220103]))
);
wait(1);
Column(dt, "Col") << Set Each Value(Informat(Char(:Col), "YYYYMMDD"));
wait(1);
Column(dt, "Col") << Format("m/d/y", 12);
-Jarmo