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
(1,112 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
(958 Views)

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

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 3 of 3
(945 Views)