03-07-2015 10:27 PM
i found an example of an application that displays the laptops battery life in seconds, and I need it to be displayed in hours, mins., seconds.
Can someone please help me convert this example, so that the time can be displayed in the format stated above?
Thanks.
03-07-2015 11:01 PM - edited 03-07-2015 11:03 PM
The code to do that already exists in the VI you attached. It just so happens it takes the 3 integers for hours, minutes, and seconds and converts them into a single string. However, I think that is not doing it correctly. Here is how it shoud be done, and also with 3 separate indicators.
03-08-2015 12:52 AM - edited 03-08-2015 12:54 AM
All you need to do is use a plain numeric indicator set to relative time format.
Almost no code needed! 😄
You can even include some of the other text by setting the advanced format to e.g. "Estimated Time: %<%H:%M:%S>t"
See attached modification.
03-08-2015 08:39 AM - edited 03-08-2015 08:42 AM
You already have two good answers, but i thought I'd put in a little broader insight on a very underutilized feature in LabVIEW - units. When working with time I almost always use units because I typically end up needing to do some sort of math on the value and the units make it so much easier.
Plus, units allow you to do really neat things. For instance take a value in a unit of length and divide it by a value in unit of time and the math knows you are calculating velocity, so even if you originally calculated miles per hour, you can, see the result in any other expression of velocity by simply changing the unit label on an indicator.
Mike...