FormatDateTime ignores locale settings


Recommended Posts

`FormatDateTime("%c", ...)` should produce a date and time represented using Window's locale settings, but version 19.1 (b2366) on Windows 10 seems to ignore Windows settings and produce dates using MM/DD/YY regardless. I first noticed the discrepancy in my logging set file time column. Note the difference in configured date/time format versus function result: 


The old Windows 7-style regional settings are still available and confirm the settings shown in the new dialog. 


Link to comment
Share on other sites

We literally call a Windows API function for this, so any issues with it not working are related to issues with Windows.  We use this function essentially:

Newer releases of Windows do a lot of weird double layer stuff. They even have two control panels!  So it may be related to that, that the function is using a different setting than what we would think to determine the locale.  Actually looking through it I believe that it may be the setting for Locale for non-Unicode apps.  DAQFactory is not unicode (at present). 

In the end of course, you can use the other specifiers to format the date however you want.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.