;; 
;;====================================================================== 
;; 
;;FUNCTION       MSDate() 
;; 
;;ACTION         Converts between Kix and MS format dates 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 2017/04/08 
;; 
;;HISTORY        1.0  - 2017/04/08 - Initial Release 
;; 
;;SYNTAX         MSDate(Date) 
;; 
;;PARAMETERS     Date - REQUIRED - A date string as mm/dd/yyyy or yyyy/mm/dd 
;; 
;;REMARKS        Returns mm/dd/yyyy for input of yyyy/mm/dd and yyyy/mm/dd for input of mm/dd/yyyy 
;; 
;;RETURNS        String 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K8, W2K12, W2K16 
;; 
;;EXAMPLES       $Date = MSDate(@DATE)       ; convert Kix date format to MS format MM/DD/YYYY 
; 
Function MSDate($_Date)
 
  Dim $_aTmp  
 
  $_aTmp = Split($_Date, '/')
 
  If UBound($_aTmp) <> 2
    Exit 87					; invalid input format 
  EndIf
 
  If Len($_aTmp[0]) = 4
 
    $MSDate = $_aTmp[1] + '/' + $_aTmp[2] + '/' + $_aTmp[0]
 
  Else
 
    $MSDate = $_aTmp[2] + '/' + $_aTmp[0] + '/' + $_aTmp[1]
 
  EndIf
 
  Exit 0
 
EndFunction