A difference of datetime is not a datetime, declare your timetocalc as int or long.
Hi ..it is very helpful to understand mqldatetime structure ...then You will be able to do much more then simple calculations
https://www.mql5.com/en/docs/constants/structures/mqldatetime

Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Date Type Structure
- www.mql5.com
Constants, Enumerations and Structures / Data Structures / Date Type Structure - Reference on algorithmic/automated trading language for MetaTrader 5
I would like to thanks Alain for his continuous support. (Also Marcin of course but Alain answer has resolved my issue).
The fact to declare timetocalc as long has definitively resolved all the issues I had last night.
(Vive la belgique !)
Pierre
The fact to declare timetocalc as long has definitively resolved all the issues I had last night.
(Vive la belgique !)
Pierre
Pierre DELAHAYE:
I would like to thanks Alain for his continuous support. (Also Marcin of course but Alain answer has resolved my issue).
The fact to declare timetocalc as long has definitively resolved all the issues I had last night.
(Vive la belgique !)
Pierre
Thanks. :-)
I would like to thanks Alain for his continuous support. (Also Marcin of course but Alain answer has resolved my issue).
The fact to declare timetocalc as long has definitively resolved all the issues I had last night.
(Vive la belgique !)
Pierre

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Good morning/evening,
After seeking all the parts of the documentation without answers, I come to you with this question :
I am calculating time elapsed during now and a fixed date.
datetime fixeddate;
datetime timetocalc;
timetocalc=TimeCurrent()-fixeddate;
Now I would like to have timetocalc as a long or double in number of second.
But when I write Print(timetocalc); program return 1970.01.03 05:10:0 (For 2 days 5 hours and 10 minutes)
I have tried StringTotime(timetocalc) without succes.
How convert 1970.01.03 05:10:00 in a long/double value equal to the number of second since January 1, 1970 ?
Thanks a lot.
Pierre