Example Code

How to Write/Read a Time Stamp to a Text File

Code and Documents

Attachment

Overview
The example shows a way to write/read a time stamp to a text file.

 


Description
The following example is a good way to write/read a time stamp to a text file. Please note that the milliseconds component of the timestamp is lost in this process. Most DAQ File I/O operations will have this functionality built in but if a program developer wanted to integrate it on a lower level, this would be one way to do it.

 


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download the attached folder to your computer
  2. Open the VI "Proper Time Stamp File IO 2012 NIVerified.vi"
  3. Run the VI

 

Additional Information or References
VI Snippet

Block Diagram.PNG

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Ben J.
National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
JoelWhittC
Member
Member
on

Bug:

Times of 12:xx PM or 12:xx AM give wrong output

Examples:

Input:

12:20:09.848 PM

8/21/2014

Output:

12:20:09.000 AM

8/22/2014

note that PM became AM and we're now in the next day.

OR

Input:

12:20:09.848 AM

8/21/2014

Output:

12:20:09.000 PM

8/21/2014

note that AM became PM