LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate time period in days, hours, minutes and seconds

Solved!
Go to solution

I am trying to make a vi that calculates the time period in days, hours, minutes and seconds, but I can't find a smart and easy way to do it.. Since the days in a month varies, I have a problem to calculate the number of days in e.g. 4 months.

 

Does anyone have a clever solution to this problem?

Please have a look at the attached vi.

 

Regards

Paul

0 Kudos
Message 1 of 3
(2,568 Views)
Solution
Accepted by topic author sandal

When you perform a math operation on two timestamps, the resulting output has a unit of seconds. You can use the Format into String function to convert those seconds into absoute time units.

 

AS you noted, months are relative and not supported in the format string function. A week is a constant of 7 days and can be calculated.

 

See attached...

 

 

Total Time (1).JPG

 

Total Time (1) FP.JPG


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 3
(2,559 Views)

That was smart and easy. Thank you for your support!

0 Kudos
Message 3 of 3
(2,549 Views)