cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
WHG
WHG
Level I

Convert character timestamp to typical numeric format

I would like to convert a character timestamp format like this one:

06/28/19 11:26:29:252

to a typical numeric format

06/28/19 11:26:29

Any help much appreciated.

7 REPLIES 7
johnmoore
Level IV

Re: Convert character timestamp to typical numeric format

Give this a try

characterStamp = "06/28/19 11:26:29:252";

lastPart = ":"||word(4,characterStamp,":");
substituteinto(characterStamp,lastPart,"");

numberStamp = informat(characterStamp,"m/d/y h:m:s")
WHG
WHG
Level I

Re: Convert character timestamp to typical numeric format

How do I apply the script to convert the old format to the new format, let's say for all values from column 1 to column 2?

txnelson
Super User

Re: Convert character timestamp to typical numeric format

The easiest way to do this is to right click on the column header for Column 2 and select "Formula".

Then place the following into the formula window

characterStamp = :column 1;
lastPart = ":"||word(4,characterStamp,":");
substituteinto(characterStamp,lastPart,"");

informat(characterStamp,"m/d/y h:m:s")
Jim
WHG
WHG
Level I

Re: Convert character timestamp to typical numeric format

This leads to this:

Capture.PNG

Any help much appreciated.

johnmoore
Level IV

Re: Convert character timestamp to typical numeric format

Almost there. Just change the format of the column to the date/time format you want.
WHG
WHG
Level I

Re: Convert character timestamp to typical numeric format

Fantastic. Thank you!

Jeff_Perkinson
Community Manager Community Manager

Re: Convert character timestamp to typical numeric format