Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
37 ratings:
 3.89 out of 5   

How Do I Convert a Date/Time String into a Timestamp Constant in LabVIEW?

Primary Software:
Primary Software Version: 8.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Full Development System

I have a Date/Time string in LabVIEW and I want to convert it into a Timestamp constant. How do I do this?

To convert the Date/Time string into a Time Stamp constant you have two primary options:

Use the Scan from String VI
  1. Place a Scan from String VI on the block diagram.
  2. Right-click the Scan from String VI and select Edit Scan String from the dropdown menu.
  3. Select Scan time stamp from the Selected operation menu.
  4. Customize the string format using the Corresponding scan string textbox. You can use the Time Stamp Format Codes to correct format the string. Note: If you leave the format string as %T, LabVIEW will guess based on commonly used formats.

Figure 1: Scan From String Method

Use the NumText.Text property of a Time Stamp control or indicator
  1. Create a Time Stamp control or indicator.
  2. Create a Property Node for the control or indicator and select the NumText.Text property.
  3. Right-click the Property Node and select Change All to Write.
  4. Right-click the Time Stamp control or indicator and select Properties.
  5. Navigate to the Display Format tab to customize the string format interactively (see Figure 3)

Figure 2: Property Node Method

Figure 3: Properties Dialog for Customizing String Format Interactively

Related Links:
LabVIEW Help:  Format Codes for the Time Format String
Tutorial: LabVIEW Timestamp
NI Community: Convert String to Timestamp
NI Community: String to Timestamp

Time Stamp to String (Both Methods).vi (LabVIEW 2013)

Report Date: 09/20/2005
Last Updated: 03/09/2017
Document ID: 3PJC3B8

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit