Example Code

Converting Number of Seconds to Elapsed Time string

Code and Documents

Attachment

In LabVIEW, the time/date functions return an unsigned integer for the number of seconds that have elapsed since 12:00 AM Friday, January 1, 1904 Universal Time. The time/date functions that convert seconds to a data or time format are meant to be used with this integer value. This example converts a number of seconds to a similar string format, but for a relative period of time.

For example, a value of 65 to the time/date functions is interpreted as the time/date 65 seconds after 12:00 AM Friday, January 1, 1904. In this example, the number 65 is interpreted as 1 minute and 5 seconds, displayed "00:01:05". The format of the output string is as follows:

[days] HH:MM:SS

The VI displays the number of days only if the time period is greater than 24 hours.

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

Contributors