Download MetaTrader 5

Datetime fileread error: returning 1970 date instead of actual on file. - page 2

To add comments, please log in or register
Demos Stogios
188
Demos Stogios  

Hello,

Since the string reads correctly, it is obvious that the problem lies in the sequence of MM and DD in your file, as stated earlier, which sequence can cause the conversion to DT to fail (as it does in your case). Your file is in the format YYYY.DD.MM, while the conversion function expects YYYY.MM.DD (MM to be before DD). You will not see it every time, since you could have 2015.05.05 which is valid in both cases, but the problem is still there 

As such, you have to write code to convert the data you are reading from the file OR

it may be easier to tell us how did you end up with such a format of DT in your file, it sure looks like a locale "issue" 

 

best regards

Vlaser91
53
Vlaser91  
Demos:

Hello,

Since the string reads correctly, it is obvious that the problem lies in the sequence of MM and DD in your file, as stated earlier, which sequence can cause the conversion to DT to fail (as it does in your case). Your file is in the format YYYY.DD.MM, while the conversion function expects YYYY.MM.DD (MM to be before DD). You will not see it every time, since you could have 2015.05.05 which is valid in both cases, but the problem is still there 

As such, you have to write code to convert the data you are reading from the file OR

it may be easier to tell us how did you end up with such a format of DT in your file, it sure looks like a locale "issue" 

 

best regards

Thank you very much Demos for being observant. Issue solved.
12
To add comments, please log in or register