LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to subtract two time?

Solved!
Go to solution

How to do TimeA-TimeB=TimeC?

 

0 Kudos
Message 1 of 24
(5,469 Views)
First check which one is greater and then subtract. I'm not sure what you're trying to do ultimately. Could you please explain the problem you are trying to solve?
0 Kudos
Message 2 of 24
(5,462 Views)

Since TimeA>TimeB in that two cases marked in red, you are getting negative values. Can you please give bit more details of your requirement?

 

Mathan

0 Kudos
Message 3 of 24
(5,460 Views)

abs.PNG

 

You can also use absolute value if you dont want negative values. Y do you want to compare it first?

Message 4 of 24
(5,453 Views)
0 Kudos
Message 5 of 24
(5,419 Views)
Firstly, in my opinion, you could just use a single get time stamp for both of the time stamps, and if you need the difference, you could use it after doing a simple greater than equal to and select. Still not sure what you're trying to achieve, with this code. Is it that do you want to see how much time has elapsed from a particular reference?
0 Kudos
Message 6 of 24
(5,420 Views)
I think NI need to improve subtract. Smiley Very Happy
0 Kudos
Message 7 of 24
(5,394 Views)

 


I think NI need to improve subtract. :smileyvery-happy:

 

 

lol!!!! :smileyvery-happy:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Wait a minute. Are you seriuos?

0 Kudos
Message 8 of 24
(5,389 Views)


Attachment 图册.jpg (53 kb)

I am still unsure of what exactly you want
0 Kudos
Message 9 of 24
(5,384 Views)

I kind of agree with Boone, but the subtract is already improved since timestamps were introduced. The difference between the two time stamps is positive, but it shows something like 1 month, -11 days, 6h, 7min, 33s.

The -11 days is a bit special...

I think the time cluster is just handled like a normal cluster in your LV version (what LV version do you use?), doing element-weise subtract. In newer LV versions timestamps are automatically converted into DBL (second counter) when subtracting.

You can just convert both timestamps to DBL before the subtraction or convert the result to DBL and you should get the difference in seconds.

 

Message 10 of 24
(5,369 Views)