10-28-2019 04:10 AM
Hello together,
with the format specifier %z I am able to add the correct time zone indicator. However, it has the form hh:mm:ss. How can I limit it to hh:mm? By default, only a "-" is displayed in front of the time zone indicator. How do I make it write a "+" if necessary as well?
Is it possible to change the "," into "." after seconds?
Actual format string:
Timestring result:
2019-10-28T10:02:06,79501:00:00
Desired format (timezone indicator only hh:mm and "." instead of "," after seconds)
2019-10-28T10:02:06.795+01:00 or 2019-10-28T10:02:06.795-01:00
Thank you for your help and tips,
Michael
10-28-2019 05:37 AM
I think you get a coma (,) because of the settings of your OS (Windows presumably), is your OS language french?
I know that when Windows' language is french, coma is the default decimal separator, you can either change that in Windows, but I woudn't recommend it or force LabVIEW to ignore the OS default decimal separator and use the dot (.)
To do that, open you labVIEW settings Tools>> Options... >> make sure the box is unticked
You'll need to relaunch LabVIEW.
Also, if you ship you code as an EXE, make sure the INI file next to your EXE contains this "useLocaleDecimalPt=False"
It will nake sure your EXE ignores the OS default adn use the dot (.)
Hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
10-28-2019 07:54 AM
Enclosed is my solution. If there is a more elegant way I look forward to receiving hints. Thank you.
10-28-2019 01:51 PM
You can force the decimal separator to be a comma (not a coma!) by putting "%,;" in your format, like this:
"%.;%Y-%m-%dT%H:%M:%S%.3u%z".
I couldn't get rid of the seconds in the timezone.
10-28-2019 01:57 PM
10-28-2019 04:56 PM
10-28-2019 08:31 PM
10-28-2019 09:55 PM
@cbutcher wrote:
although I had to close LabVIEW after changing it... (maybe just waiting a bit longer would have worked)
My experience is that LabVIEW only checks the timezone when it is first opened. So changing timezones requires a stop and restart of the LabVIEW environment.