Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;~ Duong Vox
- #include <Array.au3>
- Global $TimeZone = 7 ;Time zone in Vietnam: +7
- $ohttp = ObjCreate("winhttp.winhttprequest.5.1")
- $ohttp.Open("GET", "http://www.google.com.vn/", False)
- $ohttp.Send()
- $Date = $ohttp.GetResponseHeader("Date")
- Global $iYear = StringMid($Date, 13, 4)
- Global $iMonth = StringMid($Date, 9, 3)
- Global $iDay = StringMid($Date, 6, 2)
- Global $iHour = StringMid($Date, 18, 2)
- Global $iMinute = StringMid($Date, 21, 2)
- Global $iSecond = StringMid($Date, 24, 2)
- $iMonth = _GetMonth($iMonth)
- Global $LastMonth = _DayOfMonth($iMonth - 1)
- Global $CurrentMonth = _DayOfMonth($iMonth)
- $iHour += $TimeZone
- Select
- Case $iHour >= 24
- $iDay += 1
- $iHour -= 24
- Case $iHour < 0
- $iDay -= 1
- $iHour += 24
- EndSelect
- Switch $iDay
- Case $CurrentMonth + 1
- $iMonth += 1
- $iDayd = 1
- Case 0
- $iMonth -= 1
- $iDay = $LastMonth
- EndSwitch
- Switch $iMonth
- Case 0
- $iMonth = 12
- $iDay = 31
- $iYear -= 1
- Case 13
- $iMonth = 1
- $iDay = 1
- $iYear += 1
- EndSwitch
- Func _GetMonth($var)
- Local $aMonth[13] = [12, "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]
- Return _ArraySearch($aMonth, $var)
- EndFunc ;==>_GetMonth
- Func _DayOfMonth($sMonth)
- Local $End
- Switch $sMonth
- Case 0, 1, 3, 5, 7, 8, 10, 12, 13
- $End = 31
- Case 4, 6, 9, 11
- $End = 30
- Case 2
- If IsInt(@YEAR / 4) Then
- $End = 29
- Else
- $End = 28
- EndIf
- Case Else
- SetError(-1)
- Return (0)
- EndSwitch
- Return ($End)
- EndFunc ;==>_DayOfMonth
- MsgBox(0, "Time", $iHour & ":" & $iMinute & ":" & $iSecond & @CRLF & $iDay & "/" & $iMonth & "/" & $iYear)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement