I have a scenario where I have confirmed today's date over the Internet.
I want to get through today's date 1 year with the help of Msjbox.
I want the year-round to work stably. How can it be coded?
Code: Select all
WinHttp := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WinHttp.Open("GET", "http://worldtimeapi.org/api/ip", false) ; Get date from the internet
try
{
WinHttp.Send() ; try to execute
}
catch ; if there is an error, this block will execute
{
;~ msgbox, Could not connect to the internet, the program will exit.
;~ ExitApp
}
data := WinHttp.ResponseText ; get the info
;~ MsgBox, % data
Pos := InStr(data, "datetime")
Pos += 11
CurrentDate := StrReplace(SubStr(data, Pos, 10),"-", "") ; extract the date
FormatTime, CurrentDate,, dd.MM.yyyy
MsgBox, % CurrentDate
MsgBox, Next 1 year Date = ? ( for example current date = 09.05.2021 newdate result : 09.05.2022 )