How to effectively add a "0" before the hour or minute to a string variable for displaying the time, when using "MqlDateTime" variable?
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
Hi I use some code for showing the current and past time when my EA performs an action or event.
It converts the time from a MqlDateTime variable to a string variable with this format: "HH:MM"
When the hour or minute is before 10, it adds an extra "0" to the string, see the code:
Although this code works. Its is very clumsy and I think that it can be done more simple by using the StringFormat() function but I don't know how to use this function.
https://www.mql5.com/en/docs/convert/stringformat
Can anybody help me?
Thanks.