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

How Do I Format a Number into a Relative Time String?



Primary Software:
Primary Software Version: 7.0
Primary Software Fixed Version: 8.0
Secondary Software: N/A

Problem:
I know I can change the format of a numeric control to relative time (Right-click the control and select Format & Precision»Relative Time). However, I would like to format a numeric data value into a relative time string. Can I do this using the Format Into String or Format Date/Time String functions?

Solution:
In LabVIEW 7.1 and before, the Format Into String and Format Date/Time String functions do not support relative time format. However, the behavior may still be achieved using the attached VI. It shows how data may be formatted into a relative time string using a numeric control. This method uses the numeric control's properties to get the numeric text, and requires the front panel containing the numeric control to be loaded.

In LabVIEW version 8.0 and higher you can use the Format Into String function to specify relative time format. The code %t represents relative time in the format string syntax. You can select an appropriate format string using a dialog by right clicking the Format Into String function and selecting Edit Format String. You can also access this menu by double clicking on the function.  Refer to the documents linked below for more information on format codes for time format strings.



Related Links:
LabVIEW 2012 Help: Format Codes for the Time Format String
LabVIEW 2012 Help: Edit Format String Dialog Box
KnowledgeBase 26D9ECB5: Including Certain Characters in a Format String
KnowledgeBase 38BGK8DW: How Do I Display Relative Time in LabVIEW 7.0 in the Same Format as in LabVIEW 6.1 and Earlier?

Attachments:
Format String To Time.vi

RelTimeToText.vi - RelTimeToText.vi



Report Date: 11/04/2003
Last Updated: 08/30/2013
Document ID: 3339T6QT

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