Download MetaTrader 5
To add comments, please log in or register
Have you developed an application? Publish it in Code Base!
strontiumDog
266
strontiumDog 2015.09.09 08:04 
Hello
Every tick, I want to update a variable with the current server time zone. 

I can't find how this is done within mql4.
I'd rather avoid having to scrape this off the web. 

Can anyone tell me how to do this?

Thanks
Keith Watford
Moderator
8799
Keith Watford 2015.09.09 10:19  
strontiumDog:
Hello
Every tick, I want to update a variable with the current server time zone. 

I can't find how this is done within mql4.
I'd rather avoid having to scrape this off the web. 

Can anyone tell me how to do this?

Thanks
Why? the server's time zone won't change.
whroeder1
13936
whroeder1 2015.09.09 13:26  
strontiumDog: , I want to update a variable with the current server time zone.
datetime server = TimeCurrent(), gmt = TimeGMT();
int TZ = (int) MathRound( (gmt - server) / 3600.0 );
This will not work in the tester, however. This may change on DST.
strontiumDog
266
strontiumDog 2015.09.09 17:39  
GumRai:
Why? the server's time zone won't change.
Replying with that is clearly unhelpful.
strontiumDog
266
strontiumDog 2015.09.09 17:45  
WHRoeder:
strontiumDog: , I want to update a variable with the current server time zone.
This will not work in the tester, however. This may change on DST.

Thanks for the suggestion WHRoeder.

The code returns the difference between GMT and the current, which is fine, and I can extrapolate from there, but I'm on GMT and BST, depending on the date.  You're right, it may change on DST, but in my case it won't as the terminal is on the same time zone as the server.  What I was really looking for was a string that instantiates to 'BST' or 'GMT' etc. or a value which is different today (Sep 9 uk, BST) to this time in 2 months (Nov 9, uk, GMT).  Actually, I guess I could use UTC.

Zirkon
123
Zirkon 2015.09.11 16:08  
strontiumDog:
Replying with that is clearly unhelpful.

If you want an helpful answer, maybe you should think why people are helping others on a forum ?

Personally I am interested by Gumrai's question and your reaction doesn't encourage me to help you.

/
To add comments, please log in or register