- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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" );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Date-time format problem script
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