From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

date time

I have a date column in this format: 01/09/2011 00:00:00.0000.  It is a date/time channel.  In this data, the date is correct (dd/mm/yyyy), but the time is not.

I have a time column in this format: 01/01/0000 21:43:36.0000.  It is a date/time channel.  In this data, the time is correct, but the date is not.

I have a milliseconds column in this format: 500.  It is a numeric channel.  The miliseconds are correct, they are just not part of the time channel.

 

What is the easiest way to combine these so that I end up with a single channel of this format: 09/01/2011 21:43:36:500

 

Thanks,

Ed DeWitt

0 Kudos
Message 1 of 20
(4,837 Views)

Hi AlphaTreo,

 

The easiest way is dividing the millisecond channel by 1000 and then adding all channels. You finish it by setting the display property to "Time". Please have a look at the attachment.

0 Kudos
Message 2 of 20
(4,831 Views)

Hi Ed,

 

The simplest way to put those 3 columns together is in a DataPlugin.  Where do they come from?  ASCII file?  Excel file?  TDMS file? How are you importing that data into DIAdem?  If we can use a DataPlugin to load the data, we should be able to combine those columns automatically during loading.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 20
(4,825 Views)

I solved it this way...

 

'Convert DATE, TIME and MS columns into a single column which contains the date

' and time. Requires DATE, TIME, and MS channels to be text data types.

'Concatenate the various pieces of text together:

call Calculate("ch(""Temp1"")=Ch(""[1]/DATE"")+"" ""+Ch(""[1]/TIME"")+"":""+Ch(""[1]/MS"")",NULL,NULL,"")

'Remove the ".000" from the end

call Calculate("ch(""Temp2"")=left(Ch(""Temp1""),23)",NULL,NULL,"")

'Format into a time:

call Calculate("ch(""Date-Time"")=TTR(Ch(""Temp2""),""#MM/DD/YYYY hh:nn:ss:ffff"")",NULL,NULL,"")

'Remove temporary channels:

Call Data.Root.ChannelGroups(1).Channels.Remove("Temp1")

Call Data.Root.ChannelGroups(1).Channels.Remove("Temp2")

'Change into a time channel:

Data.Root.ChannelGroups(1).Channels("Date-Time").Properties("displaytype").Value = "Time"

 

Thanks for the help,

Ed DeWitt

0 Kudos
Message 4 of 20
(4,801 Views)

@Brad_Turpin wrote:

Hi Ed,

 

The simplest way to put those 3 columns together is in a DataPlugin.  Where do they come from?  ASCII file?  Excel file?  TDMS file? How are you importing that data into DIAdem?  If we can use a DataPlugin to load the data, we should be able to combine those columns automatically during loading.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments


Reviving an old topic here.  I have similar data:

"Date","Time","Millisecond"
"2015/01/03","21:28:06","190"

 

In the dataplugin wizard I've used date to combine for the first column and time to combine for the 2 others. I set the date time to "YYYY/MM/DD hh:mm:ss ffff" and a few other variations of the f's. 3 f's, 1 f, and nothing turns out correct. Date looks good. The time is good except it has just 0's for the fraction. Then the miliseconds column just shows a whole new time-formated value, 190 is interprested as 22:00:00 for some reason.

 

--Scott

 

 

0 Kudos
Message 5 of 20
(4,074 Views)

I did resolve by stealing/modifying a dataplugin script. Would still love to know if this can be done via the wizard.

 

--Scott

0 Kudos
Message 6 of 20
(4,031 Views)

Hi Scott,

 

As of DIAdem 2014, the ASCII DataPlugin Wizard supports putting a "Date" column and a "Time" column together into one "DateTime" column.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 7 of 20
(4,027 Views)

 


@Brad_Turpin wrote:

Hi Scott,

 

As of DIAdem 2014, the ASCII DataPlugin Wizard supports putting a "Date" column and a "Time" column together into one "DateTime" column.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments


Yea, I got that very clear Brad. But I need to combine 1 date, 2 time, the 3rd time is only the milliseconds counter. Seems that doesn't work, or I'm not doing it right.

0 Kudos
Message 8 of 20
(4,025 Views)

Hi Scott,

 

In order to put 3 columns together, you will need to program your own DataPlugin and use a ProcessedChannel for the resulting combined DateTime channel.

 

If you email or post sample ASCII files, and if they're simple, I can do that for you real quick, but it's not covered by the Wizard.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 9 of 20
(4,005 Views)

Thanks for the followup. As you saw from my other post, I did just that.

 

For others with the same question: http://forums.ni.com/t5/DIAdem/Why-is-my-Dataplugin-slower-than-the-wizard-dataplugin/td-p/3085185

 

 

0 Kudos
Message 10 of 20
(4,001 Views)