LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Seconds to Hours:Minutes:Seconds

If I have an integer holding the number of seconds, how can I convert it into a string/relavant format in the form Hours:Minutes:Seconds?

 

For example, 123 seconds should be 00:02:03.

 

If it is possible to do the above, then how can I seperate it into 00 Hours indicator, 02 Minutes indicator and 03 Seconds indicator?

Message 1 of 23
(38,363 Views)

You can do that manually. For one of my project I have made the calculation to convert the seconds to time. This will convert the seconds into to only Hours Minutes and seconds and not into the actual time format.

 

seconds to time.png

 

Good luck

 

-----

The best solution is the one you find it by yourself
Message 2 of 23
(38,359 Views)

Here are some alternative solutions, there are many more. (VI is LabVIEW 8.2)

 

Download All
Message 3 of 23
(38,354 Views)

Optimization ends here. Smiley Wink

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 23
(38,340 Views)

Timestamp.png

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 5 of 23
(38,322 Views)

@Yamaeda wrote:

Timestamp.png

/Y


But this will convert the hours to days once it exceeds 24. Also you don't have to convert you can wire the seconds directly. Smiley Wink

-----

The best solution is the one you find it by yourself
Message 6 of 23
(38,313 Views)

Here's another way to do it.  Format you DBL indicator to display absolute or relative time.

 

Message 7 of 23
(38,302 Views)

And Wayne's can be simpler if you dont mind the coercion dot. 😄

It does however have a 1 hour add, causing 123 to turn into 01:01:59

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 23
(38,287 Views)

@Yamaeda wrote:

And Wayne's can be simpler if you dont mind the coercion dot. 😄

It does however have a 1 hour add, causing 123 to turn into 01:01:59

/Y


Keep it as relative time and you don't.  I'm thinking the Absolute Time will get adjusted due to time zones.  Mine is showing 19:02:03 when set to absolute time (Eastern Time = -5 from GMT).

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 23
(38,278 Views)

Altenbach already did it the absolute simplest way to do it.  Format an Integer indicator to display time.  I added the DBL version just to remind people that you can do the same with a DBL as well. You can also get fractions of a second as well if dealing with a true timestamp.

0 Kudos
Message 10 of 23
(38,274 Views)