I've been searching for a while now and still don't have an answer.
I try to convert from a string to a timestamp value.
I can't find the correct expression to retrieve the seconds and miliseconds.
I have tried %S,%u or even %3u. still not work.
Solved! Go to Solution.
I just played around a bit and changed the comma separator between your seconds and fractional seconds to a point instead of a comma, then used the following format string:
Note I did not specify a separator between the %s and %3u. I scanned the 172 ms portion successfully.
I saved the vi and exited LabVIEW, then configured my regional settings for France. I opened the same VI and the scan string failed for the decimal point but worked when I reverted the string to your original ',' separator between the whole and fractional seconds.
I'm guessing that LabVIEW is using your localization settings to determine the <%<digits>u> portion and that your settings in your OS are for a decimal separator of "."
Yet another example of LabVIEW's quirks with respect to dealing with locale.
try the format string (no quotes) "%<%y-%m-%d %H.%M.%S.%3u>T".
In your example, you had an "%" too many behind the "M", also I replaced the comma with another period.
Hi there toto,
try dropping the comma-symbol between the seconds and milliseconds and it should be fine. (%<%y-%m-%d %H.%M.%S%3u>T).
Thank to all of you.
Unfortunately, it's not so easy. I use the French regional settings, so the separator is a coma, I don't have the choice (the string come from a filename)
I've already tried to change the coma with a dot, it has no effect on the result.
In fact, the following works, but as you can notice, it's impossible to use : in a filename.
The Scan from String function has an optional setting to set Localization Codes.
The Scan time stamp appears to ignore this setting when evaluating the %<digits>u fractional portion of a timestamp and always uses the OS locale settings. Tested in LabVIEW 8.6 and 2010
I would consider this is a bug.
The inability to use a colon ":" in a filename is normally an OS limitation. We typically use a space or underscore when naming a file that contains a date and time within the filename itself.
DNX1U FVT[FC52055531][2012 12 19][13 12 40][P].xml
The brackets are used to identify the logical parts of the name TEST[SERIAL NUMBER][DATE][TIME][PASS or FAIL]
You are correct that there is a bug with the conversion of string values to timestamps in reference to the localization code. R&D is aware of this issue as stated in this forum post: http://forums.ni.com/t5/LabVIEW/Can-t-change-decimal-sign-in-timestamp-BUG/m-p/647863 and a Corrective Action Request (CAR) has been filed. The number for that CAR is 45360. The Developers intend to correct this issue and it will be implemented in a future major revision of LabVIEW.