Dayofweek = friday

 

Hi,

I am just looking for a way to get the day of the week from my LocalTime in a program.

Is there a way/function for that please ?

Tx in advance;

 
guignath:

Hi,

I am just looking for a way to get the day of the week from my LocalTime in a program.

Is there a way/function for that please ?

Tx in advance;

MT4 or MT5?

For MT4 it is simple :

TimeDayOfWeek(TimeLocal());

For MT5 a just bit more complicated - you can do something like this :

    MqlDateTime _timeLocal; TimeToStruct(TimeLocal(),_timeLocal);
            int _timeDayOfWeek = _timeLocal.day_of_week;
or use the _timeLocal.day_of_week directly (without creating a new variable)
 
Mladen Rakic:

MT4 or MT5?

For MT4 it is simple :

For MT5 a just bit more complicated - you can do something like this :

or use the _timeLocal.day_of_week directly (without creating a new variable)
Tx! That was for MT5 ;)