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: 

Get time in hh:min

Solved!
Go to solution

Hello, 

 

I am pretty new to LabView. I am trying to carry out data acquisition on a reactor here using CDAQ. I am on the process of writing a code that would operate sequentially: heat up, hold the heat for a certain peroid of time specified by the user and cool down. I am facing lots of error due to my ignorance in LabView Environment. Right now, I am trying to get reaction time from the user and carry out the function in a while loop for that specified amount of time and stop the function after the time elapses. This was pretty straight forward, however, I want to specify the elapsed time during the run in hh:min format but I am not quite sure how to do it. I did some research over this but did not get any clarity. Any guidance would be great!!

Thanks. I have attached that part of my code for you to understand better. 

 

0 Kudos
Message 1 of 6
(2,973 Views)

I can't open your code because I only have LV2014, but I can point you in the right direction. I'm going to start to see why Snippets are so helpful on here I think.

 

Are you showing the timestamp in some other form already? If so, is that indicator a string, or a Timestamp indicator? If it's a Timestamp indicator, you can easily change the Display Format to be what you want. If it's a string, then you'll have to use your own string manipulation to display it the way you want.

 

If you aren't showing the timestamp at all yet, then maybe you are just asking how to get the elapsed time in the first place. The Elapsed Time VI is very helpful in this case (Timing palette).

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 6
(2,960 Views)

Here is the screen shot of my original code for your reference. I am not using time stamp. I am trying to get it from the elapsed time function. The output is by default seconds and so i used a simply mathematical formula to change it to hh and minutes, howere, I am not sure how to display this value now as a single output. 

Untitled.png

0 Kudos
Message 3 of 6
(2,951 Views)
Solution
Accepted by topic author vsrinivasan

Aha. All you need is a numeric indicator. Right click the indicator on the front panel after you've made it and click Display Format. Change the display format to Relative Time and voila!

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 4 of 6
(2,932 Views)

just to add, format string of relative time>>click radio button "Advance editing mode">>>insert Format string  "%<%H:%M>t"...no need for the extra functions Smiley Wink

time_VI.png

Message 5 of 6
(2,921 Views)

Oh my god, it worked. So simple. I think I am just out of my mind. 

Thanks. 

0 Kudos
Message 6 of 6
(2,915 Views)