Jump to content

Get regional/local/user settings


Recommended Posts

Thanks AZJIO,

unfortunately the answer is not in that post. The reason why a I started this post is that I depend on an application that is depending on inputs from multiple stations among which are virtual stations.

If the timedate format from those stations is not alike the (external) application, all dates get corrupted where month and day can not be swapped, in cases where month and day can be swapped the record data is set wrong (e.g. June 1st (6/1) becomes january 6th (1/6))

Rebooting the uploading stations or updating the O.S. (various Win.) have shown the timedate format can be changed without the operator being aware.  

Since the application is an external application I can not add any input filter, But I can have all stations that send data have run an autorun exe at startup to check the timedate format. (Besides other measures we've taken, an extra layer of being certain all is set correct)

Edited by Beukie
Link to comment
Share on other sites

edit: i must have missed your last paragraph - what you state there is a very bad idea. 1) it will not work, 2) it will cripple other functionality of your systems. if you must, force date format by group policy or such (i think even simple LGPO would do nicely). do not alter it on startup.

quit and dirty, if your application works with the "short date format":

this function will return 1 if system date format is DD/MM/YYYY

this function will return 2 if system date format is MM/DD/YYYY

you can adopt it to other formats as you see fit:

Func SysDateFormat()
    Local $s=_DateTimeFormat('2000/12/31',2)
    Switch StringLeft($s,2)
        Case '31'
            Return 1
        Case '12'
            Return 2
        Case Else
            Return 0
    EndSwitch
EndFunc
Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

I have interest in this subject, and have asked a few questions in the thread mentioned.

As far as I can see, your answer IS in the thread. timedate format, timezone, language etc  can all be retrieved from LCINFO.

You can try to adapt or simply define one format.

Definitions is always better as I see it, as there are many different combinations possible.

I am just a hobby programmer, and nothing great to publish right now.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...