From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Convert String to Timestamp

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
  • LabVIEW NXG

Code and Documents

Attachment

Overview

This example converts a formatted string into a timestamp. 

Description

 This code takes in an input string and converts it to a timestamp. It expects the string to be in the following format: 4/30/2004 7:48:47 PM. Any other format will cause the VI to return an error. 

Hardware and Software Requirements

Software: LabVIEW NXG 1.0 or compatible

Steps to Implement or Execute Code

1. Enter the string to be converted in the Input String control. 

2. Run the VI. 

3. Note that the timestamp will update to match the input string. 

Additional Information or References

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