02-28-2012 05:41 AM
Hi,
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.
Any idea.
Solved! Go to Solution.
02-28-2012 06:08 AM
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:
%<%y-%m-%d %H.%M.%S%3u>T
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.
02-28-2012 06:09 AM
Hello,
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.
Greetings!
02-28-2012 06:09 AM
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).
Cheers,
Cerati
02-28-2012 06:43 AM
Hi
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.
Regards
02-28-2012 06:48 AM
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.
02-28-2012 06:52 AM
Thank you wimba,
I did not noticed that I had too many %
It works
Regards
02-28-2012 06:55 AM
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.
example:
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]
02-28-2012 10:10 AM
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.
Larry H.