LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a datetime-string to a timestamp-data?

Dear sirs:

I'm getting an string which contains a date time data that I would like to
write in a timestamp control.

Then I would need to convert this string to the appropiate data type.

I appreciate any help on this matter.

Best regards,

Mauricio
0 Kudos
Message 1 of 5
(3,099 Views)
If you've only got a string to work with, you will have to parse it. Make good use of the Scan from String function to grab all the numbers between the string's various punctuation. Feed the numbers to the elements of the cluster input to the "Date/Time to Seconds" function. It will output the LabVIEW-ized timestamp in seconds. Wire up to an indicator and configure that indicator to display Date & Time. All is well.

Daniel L. Press
PrimeTest Corp.
www.primetest.com
0 Kudos
Message 2 of 5
(3,098 Views)
Thank you for your help Daniel.

"Photon Dan" wrote in message
news:506500000005000000A5240100-1042324653000@exchange.ni.com...
> If you've only got a string to work with, you will have to parse it.
> Make good use of the Scan from String function to grab all the numbers
> between the string's various punctuation. Feed the numbers to the
> elements of the cluster input to the "Date/Time to Seconds" function.
> It will output the LabVIEW-ized timestamp in seconds. Wire up to an
> indicator and configure that indicator to display Date & Time. All is
> well.
>
> Daniel L. Press
> PrimeTest Corp.
> www.primetest.com
0 Kudos
Message 3 of 5
(3,098 Views)
Hi

Anybody know how to use the scan from string function to achieve this? Relative novice here needing to convert a floating point value into a timestamp corresponding to that number of seconds.

Help appreciated!
0 Kudos
Message 4 of 5
(3,019 Views)
You can't use Scan From String to convert a numeric. The original question was how to convert a date time string (i.e. 04/08/05 10:20:00) to a timestamp. To directly convert a floating point number, you just have to use the To Time Stamp function on the Numeric>Conversion palette. Now, if your numeric is really a string representation of a number, then you would first convert the string to a number with a Scan From String. Use a %f for the format string input.
Message 5 of 5
(3,016 Views)