TimeValue - Formating a time channel

How do I Format a date/time chanel to have only the Time listed HH:MMS.
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.

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("MyHourC​hannel",DataTypeChnFloat64)
set oMChn = Data.Root.ActiveChannelGroup.Channels.Add("MyMinut​eChannel",DataTypeChnFloat64)
set oSChn = Data.Root.ActiveChannelGroup.Channels.Add("MySecon​dChannel",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

Similar Messages

  • Convert channel display format from time to numeric in a script

    I am trying to convert the Display format of a channel that contains time values (mm/dd/yyyy hh:nn:ss.ffff) from Time to Numeric. I know I can do this in the properties section of the data portal but I would like to do it in a script. I want to be able to automatically convert it without having to manually do it each time I import new data. What syntax is needed for this? 
    I've already tried the ChnPropSet (and ChnPropValSet) commands but it doesn't change the Display format after I run the script. Thanks for all your help. 
    Solved!
    Go to Solution.

    Hi Steinmeister,
    i've found a way. You can use the "ChnCalculate"-Function but you must store it to a new channel.
    Dim oGrp, oChn
    Dim sChn
    'iterate over all channels
    For Each oGrp In Data.Root.ChannelGroups
    For Each oChn In oGrp.Channels
    sChn = transformTimeChnToNum(oChn)
    If (sChn <> "") Then
    Call ChnCopy(oGrp.Name & "/" & sChn, oGrp.Name & "/" & oChn.Name)
    Call ChnDel(oGrp.Name & "/" & sChn)
    End If
    Next
    Next
    'function for transforming the channel
    Function transformTimeChnToNum(oChannel)
    transformTimeChnToNum = ""
    If (oChannel.DataType <> DataTypeChnDate) Then
    Exit Function
    End If
    transformTimeChnToNum = oChannel.Name & "_num"
    Call ChnCalculate("Ch(""" & oChannel.ChannelGroup.Name & "/" & transformTimeChnToNum & """)=Val(Ch(""" & oChannel.ChannelGroup.Name & "/" & oChannel.Name & """))")
    End Function

  • Date and Time channels in Diadem files

    I'm developing a tool to convert data files from or own format to Diadem data files format, producing a header (.dat) and a binary file (.r64).
    From my source data files, I have to convert a date channel and a time channel. Is there a way to store such channels in binary format (in the .r64 file) ?
    I got the GFS's pdf "Description of the Data formats and File set properties", but I didn't find any info about binary date or time channels.
    Thanks for help.

    Michel,
    The starting point is 01.01.0000 at 00:00:00. This time/date is the value '0'. The DIAdem time channels will be accurate until at least 12/31/2078, starting at 10/15/1582. This is due to changes made to the Gregorian calendar made back in 1582 concerning leap years.
    Today (04/18/2202) at 1:00:00 PM (13:00:00 military time) would be the value 6.31862676E+10. This number represents the number of seconds that have passed since 01.01.0000 at 00:00:00.
    DIAdem provides two functions to convert numbers into time data and time data into numerical data. They are TTR (time to real) and RTT (real to time). The DIAdem help system contains additional information on how to use these functions.
    Let me know if there is any additional information I ca
    n help you with.
    Otmar
    Otmar D. Foehner
    Business Development Manager
    DIAdem and Test Data Management
    National Instruments
    Austin, TX - USA
    "For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

  • Lmf time channel

    I am using Save LabVIEW Measurement File to get my data into a format Excel opens. One channel souce is an encoder through my serial port. The other is Force cell through my daq board. Signals are displayed on xy graph with the serial signal as x, and force y. Both signals are also graphed independently vs. Time. When I sent these signals into the Save LMF vi, I get no time channel data. I need it. Any help help on where I can import a time channel from? 

    Make certain of is that the Write to LabVIEW Measurement File (WLVM) is set up correctly. One of the options inside of the express vi is for X Value column. This is where the time data is stored. Make sure that the "empty column" is NOT selected.
    What is the source of your time data? Are you getting the time stamps from your serial device? Is the data type of your data being written to your LVM a waveform? If it isn't, you should build the waveform using the "Build waveform.vi". This requires a set of y values, an initial time (t0) and a time between each sample (dt). You can then merge your signals and write them to the LVM. Post if this works. Thanks
    Chris C
    Applications Engineering
    National Instruments
    Chris Cilino
    National Instruments
    LabVIEW Product Marketing Manager
    Certified LabVIEW Architect

  • Kvaser time history file incorrectly converting time channel

    I am using Kvaser Memorator for collecting data and when I use an older version of Kvaser Memorator Professional (2.0.6.600) to extract a .log file and then run through the CAN converter in Diadem 2011, the time channel comes in correctly.  If I use a newer version of Professional (3.02.186) to extract the same .log file and run through the CAN converter in Diadem 2011, the time channel is off by a factor of 10 (example a 30 second test now shows 3 seconds).  We have tried other permutations such as different files and even different versions of Diadem, but it still comes back to different versions of Kvaser Memorator Professional's writing of the .log file (or interpretation thereof by Diadem).  Attached is the .log file from the 3.02.186 version of Kvaser Memorator Professional.
    Any help is appreciated.
    Attachments:
    test 1 2012-07-18_21-16-38.log ‏601 KB

    Hello Rapom,
    As we assumed has Kvaser changed the file format. That was done in 2011-05-03 for version 2.9.850. Now they have a file format which is different (only the timestamp with a factor 10) to Vektor LOG files. In consequence to those facts we are going to add a new separate buslog converter for Kvaser log files for the next DIAdem version. In the meantime you need to calculate the offset correction by your own.
    Greetings
    Walter

  • How to get system time format in time stamp

    Hello All,
    I have one problem regarding Time stamp. I want system time stamp format in Time control. If my system date/time format change then automatically my time stamp format should also change.If my system Time stamp format is hh:mm:ss AM/PM dd/mm/yy so in my LabVIEW time stamp format should also same. If System time stamp format hh:mm:ss AM/PM mm/dd/yyyy so in my LabVIEW time stamp format should also same.
    So Please help me its a very important for my automation application.
    Thank You.
    Vinal Gandhi
    Kudos are always Welcome.... :-)
    Vinal Gandhi, CLD
    Software Engineer

    Hi Vinal,
    have you tried the FormatDateTimeString function with a standard string indicator and the "%c" formatcode as described in the help instead of the generic timestamp indicator?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to set a specific time zone for time channel in DIADEM

    Hi,
    I'd like to know how to autmatically set a specific time zone for time channels in DIADEM.
    For example, I have stored data with corresponding time channel in UTC time on a disk which was collected in another time zone. Now I want to analyze this data and I want the time channel to show the local time in the time zone where the data was collected, and not the time in the local time zone where the computer is located.
    The time channel should also take site local summer/winter time into account. Now I'm running a script that handles it for me which adds or subtract hours according to my input. The problem is that I'm handling data from several different time zones and I'm not located in any of them and when you're running a lot of data over a greater time period, it's easy to make mistakes, especially when it comes to summer/winter time. Is there a any clever solution to this already implemented in Diadem that I have not found? 

    Hi hj77,
    No, I'm sorry, DIAdem has no time zone functionality at all.  I'm afraid you have no choice in DIAdem but to keep running your scripts.  Summer and Winter time are truly tricky, because the rules for when the changes occur are different in different countries and states within countries and also can change from year to year within the SAME country (as they did in the US a few years ago).
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How do you add or subtract a constant from a time channel?

    I have a time channel with an offset I wish to remove. How can I do this? Using simple arithmetic means that I need to know how times and dates are stored internally, but I cannot determine this in the online help.
    e.g. Say I need to subtract 1.2 s from all the values in a time channel, in order to synchronise the data in that group with data in another group. How would I do this?
    Solved!
    Go to Solution.

    Hi PorridgeMan,
    Go to ANALYSIS->Basic Mathematics -> Offset Correction
    Greetings
    Walter

  • Hi icant sync my photos from itunes to iphone ..it shows copying 1 out of something but afterwards it stops and no photos in iphone ..i formatted several times ..and from my utunes i have sync my brothers iphone it synced prefectly only its problm of my p

    hi icant sync my photos from itunes to iphone ..it shows copying 1 out of something but afterwards it stops and no photos in iphone ..i formatted several times ..and from my utunes i have sync my brothers iphone it synced prefectly only its problm of my iphone .......i have also deleted the ipod photo cache but still the same

    can any 1 help me

  • Why does a digital indicator formatted for time & date add 16 hours to the input?

    I wire a digital indicator with a double precision value that is supposed to indicate an elapsed time. But the indicator (formatted for time and date, with the date inactive) always adds 16 hours to the wired input.
    This problem occurs even in a simple vi I wrote that only consists only of a constant wired to the indicator.
    Using LabView 6.0.2

    Labview interprets the number passed into an indicator formatted for date & time as seconds since Jan. 1st 1904. I'm assuming that since you're looking for elapsed time this is not what you're passing in. One thing that I've done is get the elapsed time in seconds and write a routine to convert that into whatever format you want.

  • Show channels with own time channel and different length in one 3D graph

    Hi,
    How can i show channels with own time channel and different length in one 3D graph?
    My consideration looks like this, but i didn't found a solution with acceptable performance. ( i have many channels to merge and many data in them)
    i have 4 Channels 2 with values and 2 with time.
    Example:
    Pair 1:
    1 - 3
    2 - 4
    3 - 5
    4 - 8
    5 - 9
    Pair 2:
    1.5 - 6
    2.3 - 7
    4.5 - 8
    I want than this result:
    1 - 3
    1.5 - null
    2 - 4
    2.3 - null
    3 - 5
    4 - 8
    4.5 - null
    5 - 9
    And
    1 - null
    1.5 - 6
    2 - null
    2.3 - 7
    3 - null
    4 - null
    4.5 - 8
    5 - null
    thanks a lot
    by
    Stefan

    Hi StefanF,
    You need to first create the timebase that you want (in this case with a 0.5 increment) using the "Generate Numeric Channel" ANALYSIS function, then use the resulting time channel in the "Linear Mapping" ANALYSIS function for each of the original channel pairs.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Add milliseconds to a time channel entry

    I am having a problem trying to add milliseconds to a time channel entry.   Currently I am using the DateAdd Function but it does not work. 
    The millisecond range is in bold in the following text.
    07/01/2008 10:05:00.0000 ' I am getting this out
    07/01/2008 10:05:00.3000 ' I need this out
     The following script is an example of what I am trying to do
    dim MuteStartTime
    dim MuteDurTime
    dim mutestoptime
    MuteStartTime = Now  
    MuteDurTime   = ".3"
    MuteStopTime = DateAdd("s", MuteDurTime, MuteStartTime)  
    msgbox "(Start " & RTT(MuteStartTime) & ") + (Duration " & MuteDurTime & " Sec) = (Stop " & RTT(MuteStopTime)&")"
    BBANACKI

    Hello BBANACKI!
    The MS script documentation describes the second parameter as a long value and it will be converted to a long if it is not!
    IMHO it is not a god idea to mixup VBS and DIAdem Date/Time functions. You can do what you want verry easy with pure DIAdem functions. The code will demonstrate this:Option Explicit
    Dim MuteStartTime
    Dim MuteDurTime
    Dim MuteStopTime
    ' preset variables
    MuteStartTime = CurrDateTimeReal
    MuteDurTime = 0.3 '!!! no string!
    ' DIAdem Date/Time is a real with 1s accurancy
    MuteStopTime = MuteStartTime + MuteDurTime
    ' show result
    MsgBox "Start " & RTT(MuteStartTime) & " + (Duration " & MuteDurTime & " Sec) = (Stop " & RTT(MuteStopTime)&""
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • Creating a time channel in the data portal and filling it with data - Is there a more efficient way than this?

    I currently have a requirement to create a time channel in the data portal and subsequently fill it with data. I've shown below how I am currently doing it:
    Time_Ch = ChnAlloc("Time channel", 271214           , 1      ,           , "Time"         ,1                  ,1)              'Allocate time channel
    For intLoop = 1 to 271214
      ChD(intLoop,Time_Ch(0)) = CurrDateTimeReal          'Create time value
    Next
    I understand that the function to create and allocate memory for the time channel is extremely quick. However the time to store data in the channel afterwards is going to be highly dependent on the length I have assigned to the Time_Ch. In my application the length of Time_Ch is variable but could easily be in the order of 271214 or higher. Under such circumstances the time taken to fill Time_Ch is quite considerable. I am wondering whether this is the most appropriate way of doing things or whether there is a more efficient way of creating a time channel and filling it.
    Thanks very much for any help.
    Regards
    Matthew

    Hi Matthew,
    You are correct that there is a more efficient way to do this.  I'm a little confused about your "CurrDateTimeReal" assignment-- is this a constant?  Most people want a Time channel that counts up linearly in seconds or fractions of a second over the duration of the measurement.  But that looks like you would assign the same time value to all the rows of the new Time channel.
    If you want to create a "normal" Time channel that increases at a constant rate, you can use the ChnGenTime() function:
    ReturnValue = ChnGenTime(TimeChannel, GenTimeUnit, GenTimeXBeg, GenTimeXEnd, GenTimeStep, GenTimeMode, GenTimeNo)
    If you really do want a Time channel filled with all the same values, you can use the ChnLinGen() function and simply set the GenXBegin and GenXEnd parameters to be the same value:
    ReturnValue = ChnLinGen(TimeChannel, GenXBegin, GenXEnd, XNo, [GenXUnitPreset])
     In both cases you can use the Time channel you've already created (which as you say executes quickly) and point the output of these functions to that Time channel by using the Group/Channel syntax of the Time channel you created for the first TimeChannel parameter in either of the above functions.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Week returned by Format Date/time String

    Has anyone tested the Format Date/Time String function with the week formating codes?
    I want to create a subfolder for each week and name the folder accordingly. For 17 December 2003 the week is 51 in the year 03 but I get week 50. For 29 December 2003 the week is 01 in the year 04 but I get week 52. For 01 January 2004 the week is 01 in the year 04 but I get week 00. For 29 December 2004 the week is 53 in the year 04 but I get week 52. For 01 January 2005 the week is 53 in the year 04 but I get week 00. There is no difference using %U or %W as code (this will be if 1 January will fall on Sunday or Monday which it does not in my examples).
    I know normally a year has weeks 1 to 52 but in some years the last week may have week
    53 as in 2004. Adding 1 to the week does not solve the problem. For 29 December 2003 it would give 53. And 53 maybe a correct week as in 2004. For 1 January 2005 it would give 1 but the week is the week in the year before.
    All the week numbering I expect is correct for Germany but the function is not. Is the numbering from the function correct for your country?
    Please reply where you are located and if the function will work right for you.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

    I have found two resources about date and time and their formats.
    One is the ISO Standard 8601, the second is a german page. On this page along with other information all definitions used by Windows is listed.
    According to this page the ISO Standard has been established in Europe and most industrial countries. In USA it is ANSI X3.30-1985(R1991) and NIST FIPS 4-1.
    Since the ANSI definition you mentioned allows only Sunday (Jewish) or Monday (Christian) as first day of the week it ignores the Islamic world. For them the first day is Saturday. I could not gather information about Buddhistic or Hinduism
    based countries.
    For my application and the market aimed the ISO format is the one which will be choosen. Using %W and handling of week 0 should do it.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • MPEG MPG file formats & quick time player

    hi
    i am new to macbook n my Q is about the MPEG & MPG file formats every time i try to play them using quick time i just have a msg telling me that i cant do so and that quick time played cant open the file. so is there any other program that i can use for mac that can play suck files ??

    Try installing flip4mac for QT. If that doesn't help you can use VLC. It is a nice program.

Maybe you are looking for