ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp scan from string

Solved!
Go to solution

Hi All,

 

A minor query about time stamps and scan from string. I needed to convert a string back to a timestamp and found the solution I needed at this post: Link

 

I wanted to make it a little more programatic and noticed that when I assembled the formatting string it would not recognise the assembled output as a Timestamp - it outputted a double. The strings inputs are identical. The double precision output converted to a Timestamp to give the correct value - so I have a work around.

 

I was just curious if this is a minor issue with LabVIEW or is this an intentional feature? Or is there some step I'm missing to coerce my output to a Timestamp.

 

Thanks,

Dave

 

timestamps.png

 

 

 

 

 

0 Kudos
Message 1 of 5
(8,915 Views)
Solution
Accepted by DeltaJ

When you wire a string constant to Scan From String, the function can auto-adapt to the input and you get the proper output automatically.   With a programmatically generated format string you need to use the Default Value input (circle with the dot) which defaults to DBL.  Just wire a Timestamp constant, or the current time, to that input.

Message 2 of 5
(8,906 Views)

That explains it - thank you,

Dave

 

 

0 Kudos
Message 3 of 5
(8,901 Views)

I convert a string to a double represented as a timestamp. The strange is that it converts wrong, if I wire a 'NaN' to the default value. Look inside the code..

 

(LabVIEW 2010 SP1)

 

Unbenannt.png

0 Kudos
Message 4 of 5
(8,239 Views)

Hi TPoint,

 

it also converts "strange" when you provide a large value in your "0" control like ±3T (or larger). Seems to be connected with allowed range of DBL values for the timestamp display…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 5
(8,227 Views)