Download MetaTrader 5

Get Server's GMT Offset from MQL?

To add comments, please log in or register
Do you know that MQL5 is an object-oriented language?
Andrei Moraru
1157
Andrei Moraru 2010.07.18 12:32 
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 2010.07.19 09:16  
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;

 

 

Andrei Moraru
1157
Andrei Moraru 2010.07.19 13:00  
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 2010.07.20 05:19  
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
Andrei Moraru
1157
Andrei Moraru 2010.07.20 11:10  
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