DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

TimeValue - Formating a time channel

How do I Format a date/time chanel to have only the Time listed HH:MM:SS.

 

Right now I have a Time Chanel of 01/19/2013  07:23:12:0000 which I believe is the default format.  I want to create a seperate channel that would only have the Time in it.  I am also trying to Seperate out the Hr, Min, Sec into individual channels as well.

 

 

0 Kudos
Message 1 of 4
(5,890 Views)

Hi Jcheese,

 

The date/time channel in DIAdem is always a numeric channel which counts the seconds since the year 0. The representation of date/time values in VIEW or REPORT can be changed by setting the format like “hh:nn:ss”.

 

Here are the settings for a VIEW table:

2013-03-13 08 47 11.png

 

 

One possible way to seperate the time information is the following script:

 

Dim oTChn, oHChn, oMChn, oSChn, iLoop

set oTChn = Data.GetChannel("MyTimeChannel")

set oHChn = Data.Root.ActiveChannelGroup.Channels.Add("MyHourChannel",DataTypeChnFloat64)
set oMChn = Data.Root.ActiveChannelGroup.Channels.Add("MyMinuteChannel",DataTypeChnFloat64)
set oSChn = Data.Root.ActiveChannelGroup.Channels.Add("MySecondChannel",DataTypeChnFloat64)

for iLoop = 1 to oTChn.Size
  oHChn(iLoop) = Hour(oTChn(iLoop))
  oMChn(iLoop) = Minute(oTChn(iLoop))
  oSChn(iLoop) = Second(oTChn(iLoop))
next

Greetings

Walter

0 Kudos
Message 2 of 4
(5,879 Views)

That solution will work but how do I then combine the seperated into one channel ?

0 Kudos
Message 3 of 4
(5,814 Views)

This depends on what you want to get.

 

If you are trying to get relative time respective to start of measurment, maybe a

 

Ch("time") = Ch("time") - Cmin(Ch("time"))

 

is more appropriate.

Of course this will make you're test data look really old, since all tests will start 2013 years ago at 1.1.0000 0:00:00.

 

In fact, adding the Hours * 3600 + minutes * 60 + seconds will give the same start date of 1.1.0000 AD, simply because it subtracts all the seconds till measurement date.

 

Michael

0 Kudos
Message 4 of 4
(5,803 Views)