TimeCurrent() gives a datetime in the past

 

Greetings,

Have picked up MQL programming after a few years and started with a very simple script. Nothing more then getting the tiem of the server. BUT despite the simplicity of this small piece of code this method returns a datetime in the near past which is: "2025.08.01 23:59" .

When I execute this script it is definitally the second day of July and two o'clock in the afternoon (my time zone UTC+2). 

What am I overlooking?

void OnStart()
{
   datetime server_time = TimeCurrent();
   string msg = TimeToString(server_time, TIME_DATE | TIME_MINUTES);
   Print(msg);
}
 

Your time-zone is irrelevant. The function returns the most recent time by the trade server (their time-zone), and during weekends, most brokers don't have any trade activity, so their "time" freezes.

When in doubt, remember to consult the documentation ... Documentation on MQL5: Date and Time / TimeCurrent

 
If you want the local time, use ... Documentation on MQL5: Date and Time / TimeLocal
 
Fernando Carreiro #:
If you want the local time, use ... Documentation on MQL5: Date and Time / TimeLocal

Thank you Fernando, I will wait till monday before jumping to other conclusions...