TimeHour function in mt5

 

Hallo everyone,

are  there alternative processes to get hours of specific time in mt5 like the TimeHour built-in function in mt4 ?

thanks in advanced

 

Articles

Migrating from MQL4 to MQL5

Sergey Pavlov, 2010.05.17 13:32

This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.
 
Ahmed Elsayed: are  there alternative processes to get hours of specific time in mt5 like the TimeHour built-in function in mt4 ?
Or just code it.
int TimeHour(datetime when=0){ if(when == 0) when = TimeCurrent();
   return when / 3600 % 24;
}
 
Ahmed Elsayed:

Hallo everyone,

are  there alternative processes to get hours of specific time in mt5 like the TimeHour built-in function in mt4 ?

thanks in advanced

You can try this:

MqlDateTime time;
   TimeCurrent(time);
Print("Current Hour: ",time.hour);