A bug with StrToTime function

 
I observed a bug when I tried to converse string "0:30" to time. A syntax StrToTime("0:30") returns time with yesterday's date, not current. I use build 200.
Milan
 

You've compiled your source yesterday. See https://docs.mql4.com/basis/types/datetime

 
stringo:

You've compiled your source yesterday. See https://docs.mql4.com/basis/types/datetime


Not the case. As you can see at https://docs.mql4.com/convert/StrToTime, the function should return current date:
var1=StrToTime("17:35");      // returns the current date with the given time
 
Milan wrote:
Not the case. As you can see at https://docs.mql4.com/convert/StrToTime, the function should return current date:
var1=StrToTime("17:35");      // returns the current date with the given time

Thank You. Documentation fixed.
 
stringo, there was no mistake in documentation. There is a bug in StrToTime function. If I want to convert string "0:30", it returns date of previous day (I am not sure if it is not the compilation date). But If I wanna convert string of "1:30", it returns current date. I want to say, there is different reaction before 1 o'clock and after. I think, the documentation was allright, so you have to modify the function. If I can say what meaning was better for me, I would prefer the function would return actual date.
Thank you
 
"17:35" - there is constant and cannot be changed within code every day. Once more see https://docs.mql4.com/basis/types/datetime
 
stringo:
"17:35" - there is constant and cannot be changed within code every day. Once more see https://docs.mql4.com/basis/types/datetime
No, stringo, I think you realy don't know what the function StrToTime() realy do.
Milan
 
I guess you wanted to say that

D'12:30:27'             //equal to D'[compilation date] 12:30:27'

means that writing only "hh:mm" does not automatically add today's "yyyy:mm:dd", but 'no user really knows what' to datetime.
 
What I realy want to say was, than the function StrToTime at the broker time between 0:00 - 0:59 returns yesterday's date and at the broker time 1:00 - 23:59 returns current date, doesn't matter of compilation date of file. Try this EA for explanation before 1:00 and after. A day doesn't start at 1:00, but at 0:00. The function have to return CURRENT date all day, not only after 1:00. What stringo tried to explain is nonsense and his repair of documentation was fault.
Milan
Files:
strtotime.mq4  1 kb
 
I see that, but if you only write "hh:mm", the function is not supposed to complete the datetime with today's "yyyy:mm:dd", if I got the document right.
 
Zap:
I see that, but if you only write "hh:mm", the function is not supposed to complete the datetime with today's "yyyy:mm:dd", if I got the document right.

It is not datetime, it is a string.
MetaEditor documentation:
Sample:
  datetime var1;
var1=StrToTime("2003.8.12 17:35");
var1=StrToTime("17:35"); // returns the current date with the given time
var1=StrToTime("2003.8.12"); // returns the date with the midnight time of "00:00"
Reason: