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: 

Time difference

Hello all , 

 

Two Different time values in string format to be subtracted. Result to be displayed as a string

 

time 3 = time 2 - time 1

 

need your guidance and tips 

0 Kudos
Message 1 of 7
(2,334 Views)

Can you be specific what is your time format in string ? e.g 10:43:16


CLD Using LabVIEW since 2013
0 Kudos
Message 2 of 7
(2,333 Views)

Essentially you will use Scan From String to convert your time strings to Timestamps, then subtract the values (you may need to convert to DBL first), then you can format the resulting DBL value to a string using Format Into String. The LabVIEW help has info on the format codes for Timestamps:

http://zone.ni.com/reference/en-XX/help/371361R-01/glang/codes_for_time_format_str/

 

0 Kudos
Message 3 of 7
(2,321 Views)

Hi kartik , 

 

time format i needed was hours and minutes . E.G :  18:43  - 12:31 

0 Kudos
Message 4 of 7
(2,316 Views)

Dear willcan

I guess this vi will help you.


CLD Using LabVIEW since 2013
Message 5 of 7
(2,307 Views)

@kartiknattar wrote:

I guess this vi will help you.


Your minutes are actually show the number of seconds after the hour.  You need another Quotient & Remainder to divide by 60.

OR

You can eliminate a lot of that code by just using the Format Date/Time String.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 7
(2,273 Views)

When I come across a solution to something, I try to make it generic.

Drop the .xnode file onto your BD.

Right-click (or click with the Operate tool) and you can change the mode and the string format.

"If you weren't supposed to push it, it wouldn't be a button."
Message 7 of 7
(2,251 Views)