;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       WebTimeFormat() 
;; 
;;ACTION         Returns a time string suitable for checking file time via http 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 2019/03/06 
;; 
;;HISTORY        1.0  - 2019/03/06 - Initial release 
;; 
;;SYNTAX         WebTimeFormat(timestamp [, fAdjust]) 
;; 
;;PARAMETERS     timestamp - REQUIRED - file timestamp in yyyy/mm/dd hh:mm:ss format 
;; 
;;               fAdjust   - OPTIONAL - a flag that when set, converts the supplied 
;;                                      time to UTC. 
;; 
;;REMARKS        Time string must be adjusted for UTC 
;; 
;;RETURNS        String in "Day, dd Mon yyyy hh:mm:ss" format. 
;; 
;;DEPENDENCIES   TimeConvert(), WeekDay() 
;; 
;;TESTED WITH    W2K8, W2K12, W2K16 
;; 
;;EXAMPLES        
; 
Function WebTimeFormat($_Src, Optional $_fAdjust)
 
  Dim $_Date, $_Time						; Date and Time values 
  Dim $_Year, $_Mon, $_Day, $_Wday				; Date values 
  Dim $_TZBias
 
  If Not InStr($_Src, '/')					; exit if not a valid date 
    Exit 87
  EndIf
 
  If $_fAdjust
    $_TZBias = 60 * Val(ReadValue('HKLM\System\CurrentControlSet\Control\TimeZoneInformation\','ActiveTimeBias'))
    $_Src = TimeConvert(TimeConvert($_Src) + $_TZBias)
  EndIf
 
  $_Date = Left($_Src, 10)
  $_Time = SubStr($_Src, 12)
  $_Year = SubStr($_Date, 1, 4)
  $_Mon  = SubStr($_Date, 6, 2)
  $_Day  = SubStr($_Date, 9, 2)
  $_WDay = WeekDay($_Date)
 
  $_WDay = SubStr('  MonTueWedThuFriSatSun', 3 * $_WDay, 3)
  $_Mon  = SubStr('  JanFebMarAprMayJunJulAugSepOctNovDec', 3 * $_Mon, 3)
 
  $WebTimeFormat = $_Wday + ', ' + $_Day + ' ' + $_Mon + ' ' + $_Year + ' ' + $_Time
 
  Exit 0
 
EndFunction