LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to import time value from text to labview

I search for it and find something on community (here) but the solution seems too complex. All I need is to transfer time data (in Hours:Minute:Second form) saved in a text file to labview. How could I do that? Is there an easy way?

 

Edit: Link

Egemen
0 Kudos
Message 1 of 12
(3,727 Views)

Hi Egemen,

 

read the text and use ScanFromString with format string "%<%H:%M:%S>T.

 

It's all in the context help...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 12
(3,720 Views)

In addition to what Gerd said, if the time is in 12-hour format, change the %H to %I. In addition, if there is an AM or PM appended to the string, you may have to add %p to capture that value.

 

Mike...

 

PS: The link in your post seems to be broken.


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 12
(3,716 Views)

A picture of what has been suggested here.

 

TimeFrom File.png

-----

The best solution is the one you find it by yourself
Message 4 of 12
(3,702 Views)

Thank you. But I have a problem on this. I have a text file that is covering time and data so I use read from spreadsheet file to use these data. I convert numer to string and after use scan from string function but it comes out error added to attachment. I added the code to the attachment too.

 

Egemen
Download All
0 Kudos
Message 5 of 12
(3,678 Views)

Hi newbie,

 

when you have mixed data you should read your "Excel" data as array of strings and convert your columns independently according to their datatype...

 

When you load your text like you do right now you will not receive any useful information for those timestamps (as you could easily see with a probe)...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(3,672 Views)

Does the first column really have numbers in it? What does the file you are reading look like?

 

MIke...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 12
(3,671 Views)

I attached the text data file below.

Egemen
0 Kudos
Message 8 of 12
(3,640 Views)

Hi newbie,

 

did you even tried to program that small snippet on your own after receiving so many suggestions?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 12
(3,630 Views)

Thank you GerdW. I tried it and it works. But is there a way to delete this date (01.01.1904) below the time data in timestamp?

Egemen
0 Kudos
Message 10 of 12
(3,614 Views)