Here is a small code I wrote:
int x0 = TimeLocal(); string x1 = TimeToStr(x0,TIME_SECONDS); int x2 = StrToTime(x1); Comment(TimeToStr(x0), "\n", x1, "\n", TimeToStr(x2));
and here is the result I got:
2007.03.21 7:58
7:58:32
2007.03.20 7:58
The last one should be 2007.03.21 7:58 also..
This only occurs if there is a difference in GMT+0 date and Local time's Date.
BTW. My computer is TimeZone +8; so by now, GMT+0 is already Mar 21 and the bug no longer there.. But if your TimeZone is still Mar 20, you will defintiely see this bug.
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
ie:
int x = StrToTime("12:00:00");
x will become the 32 bit integer relative to 1970.01.01 00:00:00
It all looks good until computer's Date is no longer same with GMT+0's Date.
ie, if my computer's date is already Mar 21 but GMT+0 is still Mar 20, then StrToTime will convert the string to "Mar 20 12:00:00" as against the intended "Mar 21 12:00:00".
Why i consider this a bug?
Simple, because it converts the string into localtime, and therefore, I expect that the date component should also be in localtime.