Forum Discussion

jackson_1's avatar
jackson_1
Frequent Contributor
13 years ago
Solved

how to set the system short date format

hi all,  i want to reset the current system short date format, how can i change it through the script? for example: current: dd/mm/yyyy set into yyyy/mm/dd.
  • HKosova's avatar
    13 years ago
    Hi Jackson,



    You can use the aqEnvironment.SetLocaleInfo method for this purpose:



    function Test()

    {

      var WM_SETTINGCHANGE = 0x001A;



      if (aqEnvironment.SetLocaleInfo(Win32API.LOCALE_SYSTEM_DEFAULT, Win32API.LOCALE_SSHORTDATE, "yyyy/MM/dd"))

      {

        // If no error, notify all running applications about the settings change

        Win32API.SendMessage(Win32API.HWND_TOPMOST, Win32API.WM_SETTINGCHANGE, 0, 0);

        Log.Message("The date format was changed successfully.");

      }

    }