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: 

compare time hour and minute

Solved!
Go to solution

hi,

          how to compare 11:30 to 12:00 the two thing is string datatype....i use string to nember converter  but it will return only  11.

0 Kudos
Message 1 of 5
(4,623 Views)

Hi,

 

11:30  = 11.30 (Replace : by .)  then convert in Numeric (use scan from string) and

12:00 = 11.00 (Replace : by .)  then convert in Numeric (use scan from string) and can comapre easily

 

compare minutes if hour value is same otherwise no need.

 

hope it helps..

 

-Amit

 

 

 

 

 

-
Amit
CLAD
0 Kudos
Message 2 of 5
(4,603 Views)

hi,

      the scan string also give two seperate number(11:30 mean 11 and 30).

0 Kudos
Message 3 of 5
(4,592 Views)

The Scan from String function will allow you to parse 11:30 into two integers, 11 and 30.  Use the Help for the function to see how it works.  Right-click on the function (once you lay it on your Block Diagram to gain access to the Edit Format String option (you'll want to use a format string something like %d:%d).  It is up to you to do the arithmetic on minutes and seconds properly (one way is to convert everything to seconds, then subtract).

 

Bob Schor

0 Kudos
Message 4 of 5
(4,586 Views)
Solution
Accepted by topic author GokulGKM

The easiest way to do this is to format the string in to a timestamp.  You can then simply subtract the stamps to tell the number of seconds in between your two timestamps.

 

to time stamp.png

Message 5 of 5
(4,569 Views)