Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Date/Time property for TDMS file?

I want to use the Date/Time property to set the date when the file was created.  How do I use this property??  The TDMS file properties list does not appear to include this property in its list of properties, which I'm still somewhat baffled by since .Author, .Title, .Name, etc. are there.  I have added a custom property to include the date in my TDMS file but this is still not what I ideally want, as doing it this way may be somewhat confusing to the end user when they view the TDMS and the bold fonted Date/Time field is empty.  See attached file.

 

Thank you,

D.

 

 

 

 

0 Kudos
Message 1 of 4
(3,778 Views)

Hi D.

 

You should be able to write to the Date/Time field using the TDMS Set Properties.vi using the string DateTime wired into the Property Names. If you put the "/" between Date and Time as it is written in the TDMS bolded property name, it will create a custom property named Date_Time. Once you have the DateTime property written correctly, you should be able to wire a Date/Time string into it to indicate when the TDMS file was created. 

-----------------------------------------------
Brandon Grey
Certified LabVIEW Architect

0 Kudos
Message 2 of 4
(3,760 Views)

Grey,

 

I am creating and writing to the TDMS file via .NET, not LabView.  

 

Thanks,

D.

0 Kudos
Message 3 of 4
(3,757 Views)

Yeah sorry, I realized that after I posted the message. The process is pretty much the same. If you add a property named DateTime to the TDMS file, and give it a date/time string, it will again write to that Date/Time field in the TDMS file. I've posted an example of this below. 

 

 

TdmsFile file = new TdmsFile(@"C:\test.tdms", new TdmsFileOptions());

TdmsProperty dateTime = new TdmsProperty("DateTime", TdmsPropertyDataType.String, "06/16/2016");
file.AddProperty(dateTime);

 

You could easily replace the 06/16/2016 with a DateTime String.

-----------------------------------------------
Brandon Grey
Certified LabVIEW Architect

0 Kudos
Message 4 of 4
(3,755 Views)