Getting GMT-Time with WebRequest() - page 2

 

You need a web service that has json response

Try this code:

#include <StringUtils.mqh>  // https://www.mql5.com/en/code/35395

string Read_URL(string _url,bool ShowErrorMessage);

void OnStart()
  {
   string response = Read_URL("https://worldtimeapi.org/api/timezone/Etc/GMT",true);
   string unixtime = StringSubstrAfter(response, "\"unixtime\":", 10);
   Print("GMT = ", (datetime)(ulong)unixtime);
  }
 
amrali:

You need a web service that has json response

Try this code:

Thank you for the code. It seems it is for MT5 only?

For MT4 I get an error:

'ArrayReverse' - function not defined StringUtils.mqh 699 4


 
Alain Verleyen:

For example.
https://stackoverflow.com/questions/50885249/how-to-get-gmt-by-using-google-time-zone-api

There are others API available.

Thank you as well.

Is there a way to implement this in mql?