Detect Timzone

Back to topics list To post a new topic, please log in or register
avatar
55
strontiumDog 2015.09.09 10: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
avatar
Moderator
3412
GumRai 2015.09.09 12: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.
avatar
12992
WHRoeder 2015.09.09 15: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.

avatar
55
strontiumDog 2015.09.09 19:39 #
 
GumRai:
Why? the server's time zone won't change.
Replying with that is clearly unhelpful.
avatar
55
strontiumDog 2015.09.09 19: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.

avatar
125
zirkoner 2015.09.11 18: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.

Back to topics list  

To add comments, please log in or register