Example Code

Set Filename with Current Date/Time using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview
This example VI enables files to include the date and time in its filename. 


Description
When logging lots of sets of data in LabVIEW, we often want to distinguish what each set of data represents. One way to do this, is to set the filename to match the current date/time so this simple VI does just that. All the user has to do is locate the folder that they want to save their new file to, then it will create a text file with the name Date Month Year Hour-Min-Sec.txt using some simple string manipulation.


Requirements

  • LabVIEW Base Development System 2012 (or compatible)


Steps to Implement or Execute Code

  1. Open the VI "Date File Name 2012 NIVerified.vi"
  2. Set the file path for the files to be saved
  3. Run the program

 

Additional Information or References
VI Block Diagram

 SnapCrab_Date File Name 2012 NIVerifiedvi Block Diagram_2017-7-25_21-39-0_No-00.png

 

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

Tori
Student

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

Comments
erinyen
Member
Member
on

Hi Tori,

i am starting to use myRIO for my application and encounter some issues while saving file to USB via myRIO.

my purpose is to grab image every 5 sec and give a file name as current time/date.

myrio execute single time w/o while loop and save files successfully, somehow it runs under whileloop for every 5 sec, it cannot save image.....

not sure how it goes right...

kindly be advised and thank you very much!

btw, i have no idea of attaching VI into this dialog....