Jump to content

DateTimePicker and Calendar Type


Anas
 Share

Recommended Posts

Hi,

 

I'm looking for a way to change the date in a DateTimePicker control using the user locale calendar type (which is not Gregorian calendar).

The problem is GuiCtrlSetData doesn't work unless I use a Gregorian calendar date type, even though the date control (and GuiCtrlRead) is showing/using the user locale calendar type/date and not the Gregorian calendar.

To help clear things up, here is today date in both calendars:
Gregorian calendar = 2016/11/01
Umm al-Qura calendar = 1438/02/01 (This is the user locale date)

 

I've tried to use ControlSend and ControlSetText to send the date as text but it didn't work. (DTP UDF doesn't work when using this calendar type date either)

Any other way to override the set date in the control?


To test this you need to change the user locale first, this will change it to "ar-SA" locale, you can change it back by changing country code (e.g. en-US) or from Control Panel\Region and Language.

Local $Path = @TempDir & '\Locale.xml', $TXT = '<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">' & @CRLF & _
            '<gs:UserList>' & @CRLF & _
            '<gs:User UserID="Current"/>' & @CRLF & _
            '</gs:UserList>' & @CRLF & _
            '<gs:UserLocale>' & @CRLF & _
            '<gs:Locale Name="ar-SA" SetAsCurrent="true" />' & @CRLF & _
            '</gs:UserLocale>' & @CRLF & _
            '</gs:GlobalizationServices>'

FileWrite($Path, $TXT)
RunWait('control.exe intl.cpl,,/f:"' & $Path & '"', @SystemDir, @SW_HIDE)
FileDelete($Path)

 

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...