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.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Add seconds to a timestamp in a string.

Hello all,

 

I would like to add seconds to a timestamp in a string.

For example,

"2022/10/21 09:55:03.734" +2.5s = "2022/10/21 09:55:06.234"

"2022/10/21 09:55:03.734" +305.6s = "2022/10/21 10:00:09.334"

 

In C# programming, it would be super easy since I could parse the string as a DateTime object and then use the "addseconds" function. 

Are there any functions (I didn't find any) which could help to make it easy in TestStand?

Or have I no other possibilities than coding this logic myself? Which is of course possible but a bit messy.

 

Best regards,

Ludovic

0 Kudos
Message 1 of 3
(782 Views)

Dear Lchar,

 

There is no such function in testand, however you can convert your time to number add the seconds and then convert back. Here's a forum post for converting time to number https://forums.ni.com/t5/NI-TestStand/Calculate-with-timestamps-in-string-format/td-p/231843.

best,

anasei.

0 Kudos
Message 2 of 3
(628 Views)

You can use C# as well. DateTime object methods are at your fingertips.

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.
0 Kudos
Message 3 of 3
(615 Views)