LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Seconds to Hours:Minutes:Seconds


@Wayne.C wrote:

Altenbach already did it the absolute simplest way to do it.  Format an Integer indicator to display time.


I added that just as a bonus, because the question was not entirely clear. 😄 Yes, I actually had it first as a DBL, but the original question was talking about integers, so I adapted it.

 

It does not deal with the second (no pun :D) part of the problem:

 

"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?"

 

And that's why I added the solution where we get three array elements. If that's still not "seperate" enough, an "index array" will probably help. 😄

0 Kudos
Message 11 of 22
(7,858 Views)

Of course a pure math solution such as P@Anand's above can also be "simplified", and that's probably what I would use (bottom of code):

 

 

 

(EDIT: corrected label mixup. Thanks crossrulz)

Download All
Message 12 of 22
(7,851 Views)

...except what you labeled at hours is really minutes and minutes and really hours for the "pure math" version.


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
Message 13 of 22
(7,844 Views)

Yes, modify as needed. I will correct it later. Sorry about that. (It is correct here already...) 😄

0 Kudos
Message 14 of 22
(7,838 Views)

this one also works 🙂

0 Kudos
Message 15 of 22
(7,730 Views)

Actually, shalins, your VI does not work. Put in 123 seconds and see what you get. You need to lose the last "Quotient&Remainder". Wire the remainder from minutes directly into the format string for seconds.

0 Kudos
Message 16 of 22
(7,725 Views)

@Shalins wrote:

this one also works 🙂


No, it does not work!! No matter what the input is, the "seconds" is always zero. Please check your work first. (the fix is easy, simply remove some code. 😉 Try it!)

 

(It is also about orders of magnitude more complicated than the above solutions and peppered with coercion dots. So what's the point?).

 

In additions, please stick to normal characters in filenames. Windows cannot deal with your file unless I rename it first.

0 Kudos
Message 17 of 22
(7,719 Views)

@BillMe wrote:

Actually, shalins, your VI does not work. Put in 123 seconds and see what you get. You need to lose the last "Quotient&Remainder". Wire the remainder from minutes directly into the format string for seconds.


yes....I've fixed it 😉 thnx

0 Kudos
Message 18 of 22
(7,703 Views)

I have a question similar to the forum so I decided to post here. I am also wanting to convert seconds to minutes, but I am using an array that shows me lap times that are accumulating. Can I apply the same type of solutions shown here to get an output in HR:MIN:SEC?

 

This is an example program I found, and am trying to alter for practice.

 

I attached a portion of the VI for clarification. 

 
 

0 Kudos
Message 19 of 22
(7,638 Views)

Late reply IUPUI, but you can use the same ideas. The easiest is to change the indicators format to show time.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 20 of 22
(7,619 Views)