Graham from Brisbane: My alert panel returns 2022.12.08 10:40 Result.csv which is what I expected.
A colon terminates the device name (C:) thus your file name is invalid.
Graham from Brisbane #:Sorry Mr. R, I'm not sure what you mean .... If I change to _filename = "Result.csv", leaving out the date and time, everything works perfectly well.
You can't have the character ":" in a file name. It is invalid. It is used for drive name (e.g. "C:\").
So you will have to use a different format for the time (e.g. "h" instead of ":", "20h34" instead of "20:34").
So once you have the Date and Time string, replace the ":" with "h".
string _datetime = TimeToString( TimeLocal() ); StringReplace( _datetime, ":", "h" ); string _filename = _datetime + " Result.csv";
Fernando Carreiro #:
Ahhhh... Thank you very much. Now I understand perfectly. Fantastic ..... :)
You can't have the character ":" in a file name. It is invalid. It is used for drive name (e.g. "C:\").
So you will have to use a different format for the time (e.g. "h" instead of ":", "20h34" instead of "20:34").
So once you have the Date and Time string, replace the ":" with "h".
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
Hi All,
I hope somebody out there can help me.
I want to add the date and time to my csv file handle, so that my filename will be something like 2022.12.08 10:40 Result.csv
If I do this:-
My alert panel returns 2022.12.08 10:40 Result.csv which is what I expected.
However if I do this:-
the file isn't generated. If I don't try to include the date and time, all works perfectly well.
I've tried umpteen combinations, all to no avail.
Please help ...