LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert decimal number into time ?

Solved!
Go to solution

Hi guys,

 

I have to convert decimal number like 11.02, 73.56 to 00:00:11 or 00: 01:56 time format. 

 

Can anyone guide me how to solve this problem? 

0 Kudos
Message 1 of 4
(265 Views)
Solution
Accepted by topic author Hk637

Hi Hk,

 

suggestions:

The "numeric" indicator uses the "relative time" display format…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(252 Views)

Just change the display format for Time Output

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
Message 3 of 4
(231 Views)

@Hk637 wrote:

I have to convert decimal number like 11.02, 73.56 to 00:00:11 or 00: 01:56 time format. 


The term of your problem are poorly defined and it would help to attach some simple code that contains what you actually have. The correct solution critically depends on the exact definitions. I assume the input values are in units of seconds, right? The word decimal is a cosmetic property how a value is presented, not a datatype.

 

Your "decimal number" of 11.02 could be:

 

  • a numeric datatype (e.g. DBL) with the control|indicator|constant set to decimal display.
  • A string containing the five printable characters "1", "1", ".", "0", "2"
  • or something else

Your "time format"  of 00:00:11 could be :

 

  • a numeric datatype (e.g. DBL) with the control|indicator|constant set to relative time display.
  • A string containing the eight printable characters "0", "0", ":", "0", "0", ":" "1", "1"
  • or something else.

Also please explain the math behind turning "73.56" into "00:01:56". Shouldn't that be roughly "00:01:13"?

 

Once we have the correct definition of the problem, the solution will be trivial. If possible, you should also define what should happen for much larger inputs. For example if the input value corresponds to more than 24 hours, do you also want days or just larger hour values?

0 Kudos
Message 4 of 4
(201 Views)