Function always returns 0
Its possible that I am not doing this correctly.
Other function rely on this so could someone show me how its suppose to work?
I don't have a problem using the same code to generate the correct code. Just not with the function that is in the datetime lib.
It's interesting that you managed to compile through and run to see 0 as the result... I couldn't even compile... LOL
At least, not until I make these changes:
#include <\Tools\DateTime.mqh> void OnStart() { //--- CDateTime CDt; int getint = 4;//Month(); CDt.DateTime(TimeLocal()); int dayinmonth = CDt.DaysInMonth(); Print ("Month int is: ",getint," Number of days in month is: ",dayinmonth); }
and the result is 30.
It's interesting that you managed to compile through and run to see 0 as the result... I couldn't even compile... LOL
At least, not until I make these changes:
and the result is 30.
So as long as the MqlDateTime struct is initiated it will be pushed to the function.. thank you..
So as long as the MqlDateTime struct is initiated it will be pushed to the function.. thank you..
//Get Month output days in month //Change Month by increment and get new days of the month //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- CDateTime CDt; //CDt.DateTime(TimeLocal()); //Fills the TimeStruct /* IF REMOVED and the TIMESTUCT IS NOT FILLED Output = 3000.12.05 00:59:59 The default DateTime is printed https://www.mql5.com/en/docs/basis/types/integer/datetime */ CDt.DateTime(TimeLocal()); int dayinmonth = CDt.DaysInMonth(); //Output the Data in DataTime TimeStuct Print("Current DateTime Object CDt : ",CDt.DateTime()); Print("Current Number of Days in the month of the CDt Object",dayinmonth); CDt.MonInc(dayinmonth); //Only Modifies the Cdt Object int daysinmonth = CDt.DaysInMonth(); Print("Modified DateTime Object CDt : ",CDt.DateTime()); //CDt.DateTime is the Proof of the Object Change. Print("Modified Number of Days in the month of the CDt Object",daysinmonth); } //+------------------------------------------------------------------+Just in case anyone has interest... this is the code with comments of why..
Is it possible to change first day of the week?
I need to change Sunday to Saturday in meta5 to getting better info
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Function always returns 0
Its possible that I am not doing this correctly.
Other function rely on this so could someone show me how its suppose to work?
I don't have a problem using the same code to generate the correct code. Just not with the function that is in the datetime lib.