Does MT4 have "sprintf" type function?
I wanted to print datetime in "hh:mm:ss" but TimeToStr drops the seconds. And in such a case, I have to write my own subroutine that will retunr datetime in "hh:mm:ss" (but not h:m:ss).
The only way I currently know how to do with MT4 is through the use of complex MathCeil, MathMod, CharToStr for each and every digit....
a sprintf functionality saves the whole trouble in just one single instruction.
I wanted to print datetime in "hh:mm:ss" but TimeToStr drops the seconds. And in such a case, I have to write my own subroutine that will retunr datetime in "hh:mm:ss" (but not h:m:ss).
The only way I currently know how to do with MT4 is through the use of complex MathCeil, MathMod, CharToStr for each and every digit....
a sprintf functionality saves the whole trouble in just one single instruction.
Try
string TimeToStr(datetime value, TIME_SECONDS) //gets result as "hh:mi:ss".
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
I wanted to print datetime in "hh:mm:ss" but TimeToStr drops the seconds. And in such a case, I have to write my own subroutine that will retunr datetime in "hh:mm:ss" (but not h:m:ss).
The only way I currently know how to do with MT4 is through the use of complex MathCeil, MathMod, CharToStr for each and every digit....
a sprintf functionality saves the whole trouble in just one single instruction.