03-12-2013 12:03 PM
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.
03-13-2013 02:50 AM
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:
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
03-25-2013 02:55 PM
That solution will work but how do I then combine the seperated into one channel ?
03-26-2013 06:01 AM
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