Download MetaTrader 5

Get Server's GMT Offset from MQL?

To add comments, please log in or register
Andriy Moraru
1258
Andriy Moraru  
Is it possible to get server's time GMT offset from MQL somehow? If not, will it be implemented?
Documentation on MQL5: Date and Time / TimeGMT
  • www.mql5.com
Date and Time / TimeGMT - Documentation on MQL5
Paul
784
Paul  
enivid:
Is it possible to get server's time GMT offset from MQL somehow? If not, will it be implemented?

 

Should be able to calculate it from

double ServerGmtOffsetHours=(TimeCurrent()-TimeGMT())/3600;

 

 

Andriy Moraru
1258
Andriy Moraru  
phampton:

 

Should be able to calculate it from

 

 

It won't work as the TimeCurrent() returns the server's time and TimeGMT() returns the local (PC) time.
Paul
784
Paul  
enivid:
It won't work as the TimeCurrent() returns the server's time and TimeGMT() returns the local (PC) time.

 

I don't think it does: what you're referring is TimeLocal(). 

 https://www.mql5.com/en/docs/dateandtime/timegmt 

 "Returns the GMT, which is calculated taking into account the DST switch by the local time on the computer where the client terminal is running."

Documentation on MQL5: Date and Time / TimeGMT
  • www.mql5.com
Date and Time / TimeGMT - Documentation on MQL5
Andriy Moraru
1258
Andriy Moraru  
phampton:

 

I don't think it does: what you're referring is TimeLocal(). 

 https://www.mql5.com/en/docs/dateandtime/timegmt 

 "Returns the GMT, which is calculated taking into account the DST switch by the local time on the computer where the client terminal is running."

That's what it does. It returns the local time but converted to GMT. You can try it.

What I asked for is how to get the server's GMT offset (or GMT time).

To add comments, please log in or register