07-10-2017 01:22 PM
I'm trying to convert a string that is just a date (ie 7/10/2017), and for whatever reason the day and year will be correct, but the month is always 12 (ie 12/10/2017).
Can someone guide me with this problem?
Solved! Go to Solution.
07-10-2017 01:34 PM - edited 07-10-2017 01:34 PM
So the string should be Month/Day/Year? Then you should be explicit. Otherwise the format will use the system format.

07-10-2017 01:42 PM
Thanks! It is exactly that!
05-17-2021 06:09 AM
Hello!
I am trying to convert date string to number, to feed as the X values in a XY Graph, but I only have access to Labview 7.1. I cannot find this conversion button (which is shown in the answer to this problem) anywhere. Can someone please let me know if it is available in Labview 7.1? If this is not available, is there any simple way to do this?
Thank you very much in advance.
05-17-2021 06:13 AM
Hi gracabrotas,
I'm sure LabVIEW7.1 already knows about the ScanFromString function…
@gracabrotas wrote:
If this is not available, is there any simple way to do this?
You can always switch back to parse your string "manually" by splitting it into substrings and use the StringToNum conversion functions on day/month/year substrings. But again: LV7.1 surely knows the ScanFromString function…
05-17-2021 09:33 AM
@GerdW wrote:
Hi gracabrotas,
I'm sure LabVIEW7.1 already knows about the ScanFromString function…
@gracabrotas wrote:
If this is not available, is there any simple way to do this?
You can always switch back to parse your string "manually" by splitting it into substrings and use the StringToNum conversion functions on day/month/year substrings. But again: LV7.1 surely knows the ScanFromString function…
It seems to me there was at least one caveat about scan from string with timestamps in LV 7.1 but I cannot remember what it was...
05-18-2021 01:13 AM
@GerdW wrote:
I'm sure LabVIEW7.1 already knows about the ScanFromString function…
LV 7.0 definitely didn't support the %<>T code needed to parse a timestamp and I'm fairly sure 7.1 didn't either. I think it was added in 8.0.
As you said, the practical solution is to break it into parts and then build it back up. Assuming the string is in a fixed format, then it's fairly easy to parse it in fixed way. In any case, the date time rec cluster is your friend, as you can use that directly with the parts of your string and then convert it to a timestamp using the built in function (which I'm fairly sure should be there in 7.x).
05-18-2021 04:53 AM - edited 05-18-2021 04:53 AM
@GerdW wrote:
Hi gracabrotas,
I'm sure LabVIEW7.1 already knows about the ScanFromString function…
Yes it does, but that function does not know about the %<>T format specifier as explained by Yair. Neither does Format into String.
The Scan From String can still be used but you need to scan the parts separately and convert them accordingly using the Data/Time to Seconds node. However, extra care needs to be taken as the Timestamp is in fact a "yes indeed" timestamp and therefore uses timezones. And a date only timestamp happens to be exactly on the brink between two dates, so if you are not careful about it and transfer a binary timestamp between two computers with different timezone settings, your timestamp as a date is suddenly a day off.
05-20-2021 09:04 AM
Hello everyone!
Indeed 7.1 did not accept the %< >T code, and I had to change tactics. It took me a while to get the right result, but by using elapsed time I could do what I needed.
I know this is not the best coding technique, but I am a chemist, and I don't know much programming. For now, as long as it works, I'm happy 🙂
I found labview really helpful, and I will try to learn it better to improve my skills. I am still struggling especially with arrays and clusters, but I will get there!!
Here is the final version of the program I made. Again, I know it's not pretty, but it works.
Thanks to everyone who helped me!!
06-20-2022 05:57 AM - edited 06-20-2022 06:06 AM
I try to do something very similar, but with an hour/minute/seconds timestamp you see below. Checking the context help the %p specifier should catch the AM/PM flag, but the cluster output always has 9 for an hour. For PM it should be 21.
What do I miss here?
thx!
UPDATE: nevermind... in this case %I should be used instead of %H