You can find some info in the book:
If the supported syntax in the string is broken, the result is the current date.
...
In addition to StringToTime, you can use the cast operator (datetime) to convert strings to dates and times. However, the advantage of the function is that when an incorrect source string is detected, the function sets an internal variable with an error code _LastError (which is also available via the function GetLastError). Depending on which part of the string contains uninterpreted data, the error code could be ERR_WRONG_STRING_DATE (5031), ERR_WRONG_STRING_TIME (5032) or another option from the list related to getting the date and time from the string.
MQL5 Book: Common APIs / Built-in type conversions / Date and time
- www.mql5.com
Values of type datetime intended for storing date and/or time usually undergo several types of conversion: into lines and back to display data to...
This behavior information should be added to the online MQL5 documentation.
Thanks.
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
What happens when StringToTime fails to convert a string to datetime?
The MQL5 documentation does not say how an error is indicated.