Convert a Date/Time String into Timestamp Data in LabVIEW

Updated Mar 12, 2024

In LabVIEW, you can convert string data to timestamp data. This might be helpful if you are looking to include a timestamp alongside your data in your measurement file or easily compare time between two data points. This tutorial shows you methods to convert date and time information from string data to timestamp data in LabVIEW.

There are two primary methods to convert data from string to timestamp datatype:

Use the Scan from String VI

  1. On your LabVIEW VI block diagram, right-click to open the Functions Palette and navigate to Programming >> String >> Scan from String.
  2. Configure that Scan from String VI
    1. Right-click the Scan from String VI and select Edit Scan String from the dropdown menu.
    2. From the Selected operation menu, select Scan time stamp
    3. Customize the string format using the Corresponding scan string textbox. Use the Time Stamp Format Codes as guidance to match the format of your string data.
      • The example shown in this article uses the following format string: %<%I:%M:%S%3u %p%m/%d/%Y>T
      • An example input string that works with the example shown in the article is: 4:43:25.628 pm 3/11/2024
      • Note: If you leave the format string as %T, LabVIEW will guess based on commonly used formats.
    4. Select OK. Notice that a string constant matching the configuration set in the previous set is automatically wired to the format string input.
  3. Wire in your string data/type data into the input string.
  4. Right-click the output 1 node and select Create Indicator.


Use NumText.Text property of a Time Stamp indicator

  1. Add a Time Stamp Indicator to your VIs front panel using quick drop.
  2. On the block diagram, right-click the timestamp indicator icon and select Create >> Property Node >> Numreic Text >> Text to create a NumText.Text property node.
  3. Right-click the Property Node and select Change All to Write.
  4. Right-click the Time Stamp indicator and select Properties.
  5. Navigate to the Display Format tab to customize the time and date output format, then select OK.