cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
Ole_Luehn
Level III

Date-time format problem script

Hi there. 
I have a kind of little problem with my data-format.

When importing data via a REST-API (https) link, I get the data-table and want to format the time from character and nominal to numeric and continuous.

As I got a new link, the data-format changed.

The problem is I did try the presettings in the colomn info, but was not successful. 

Before, depending of course on the data-format, the following worked in my script - where all kinds of plots and SPC is done afterwords - with right time format.

dt:TSstartR800 << Set Data Type( Numeric ) << Modeling Type( continuous ) << Format( "Locale Date Time h:m:s" );


//here I need to place and exchange "Local Date Time h:m:s" by something that works on the format in the colomns in the attached data-table...but how?
Can you double-check the table with the data-format?

 

@txnelson --> seems that you know or I guess you might be able to help.

@eromeu  --> Hi Emannuel. I try the forum --> if this works I extended the work from Bernd and me a bit. 

 

Best wishes.

Ole

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Date-time format problem script

Hi,

 

I'm not sure if there is a better way to do this, but I added a line of script that removes the "+0000" at the end of each date string, and then did the date time conversion (see below).  Does this do what you're after?

 

for each row(:TSstartR800= munger(:TSstartR800, 1, "+0000",""));
:TSstartR800<< Set Data Type( Numeric ) << Modeling Type( continuous ) << Format( "Locale Date Time h:m:s" );

View solution in original post

3 REPLIES 3

Re: Date-time format problem script

Hi,

 

I'm not sure if there is a better way to do this, but I added a line of script that removes the "+0000" at the end of each date string, and then did the date time conversion (see below).  Does this do what you're after?

 

for each row(:TSstartR800= munger(:TSstartR800, 1, "+0000",""));
:TSstartR800<< Set Data Type( Numeric ) << Modeling Type( continuous ) << Format( "Locale Date Time h:m:s" );
txnelson
Super User

Re: Date-time format problem script

If you strip off the + and the values after it, the yyyy-mm-ddThh:mm:ss format will handle the conversion

For Each Row( :TSstartR800 = Word( 1, :TSstartR800, "+" ) );
dt:TSstartR800 << Set Data Type( Numeric ) << Modeling Type( continuous ) <<
inFormat( "yyyy-mm-ddThh:mm:ss" )<< Format( "Locale Date Time h:m:s" );
Jim
Ole_Luehn
Level III

Re: Date-time format problem script

Dear Hadley and sorry Jim.
I took the first answer from Hadley and tried it quickly.
Yes - problem is solved for the moment. I just double-checked it in a seperate script copying - pasting the line from Hadley.
My Time is now numeric & continuous and I can continue with the importing of data and analytical set-up.

Thank you both very much.
Ole