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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert numeric (in time format) to string

Solved!
Go to solution

Hi,

I've a numeric control (in time format) in which I have hours:minutes:seconds and I want to convert it into a string. The problem is that the hours number is incremented by one, and if I insert a number of hours bigger than 24 the string doesn't display it correctly.

What should I do to make it work?

Thanks

Download All
Message 1 of 3
(3,951 Views)
Solution
Accepted by topic author biomed87

You are using a function that is set to take a numeric value that is based on the UTC clock and then convert it to a clock display based on your current timezone.  My guess is that you are in GMT +1 which is why you see an hour added to it.

 

You need to use the Format Into String function for this with the appropriate time codes set for the format codes.    %t  is for relative time.  This takes number you enter and turns it into hours, minutes, and seconds, rather than trying to create a clock display for it.  Which is why your code can't roll beyond 24 hours.   (There is no 25 o'clock on a clock face).

 

Message 2 of 3
(3,940 Views)

Want an ISO 8061 standard time string?  Then you need to slightly modify the scan, and format into string, formatting options.

 

https://lavag.org/topic/15034-timestamp-support-for-format-into-string-scan-variant-from-string-stri...

0 Kudos
Message 3 of 3
(3,900 Views)