;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       IntlDate() 
;; 
;;ACTION         Returns the date provided in locale-specific format 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 2019/10/26 
;; 
;;HISTORY        1.0  - 2019/10/26 - Initial Release 
;; 
;;SYNTAX         IntlDate(date) 
;; 
;;PARAMETERS     date - REQUIRED - Date in ISO format (YYYY/MM/DD) 
;; 
;;REMARKS        Part of date internationalization tools 
;; 
;;RETURNS        Date in Locale-Specific format 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K8, W2K12, W2K16 
;; 
;;EXAMPLES        
; 
;                $Date = IntlDate(@DATE)	; return date in local format 
; 
Function IntlDate($_Date)
 
  Dim $_RKey							; Root key Path 
  Dim $_iDate							; date format 
  Dim $_sDate							; date separator 
  Dim $_aDate							; Date array 
  Dim $_Time							; Time part 
 
  If Not InStr($_Date, '/') Exit 1 EndIf                        ; exit if not date format 
 
  ; Define the key and get format data 
  $_RKey  = 'HKEY_CURRENT_USER\Control Panel\International'
  $_iDate = ReadValue($_RKey, 'iDate')
  $_sDate = ReadValue($_RKey, 'sDate')
 
  ; handle when time is included 
  If InStr($_Date, ':')
    $_Time = ' ' + Split($_Date, ' ')[1]
    $_Date = Split($_Date, ' ')[0]
  EndIf
 
  ; Split date into array 
  $_aDate = Split($_Date, '/')
 
  ; Trim leading zeros 
  If Not Val(ReadValue($_RKey, 'iLZero'))
    $_aDate[1] = Int($_aDate[1])
    $_aDate[2] = Int($_aDate[2])
  EndIf
 
  ; Change to the locale-based format 
  Select
   Case $_iDate = 0
    $_aDate = $_aDate[1], $_aDate[2], $_aDate[0]
    $IntlDate = Join($_aDate, $_sDate) + $_Time
   Case $_iDate = 1
    $_aDate = $_aDate[2], $_aDate[1], $_aDate[0]
    $IntlDate = Join($_aDate, $_sDate) + $_Time
   Case $_iDate = 2
    $_aDate = $_aDate[0], $_aDate[1], $_aDate[2]
    $IntlDate = Join($_aDate, $_sDate) + $_Time
  EndSelect
 
  Exit 0
 
EndFunction