string now_date=TimeToStr(TimeCurrent()); StringReplace(now_date,".",""); StringReplace(now_date," ",""); StringReplace(now_date,":",""); Print(now_date);I don't know if this is the most efficient way, but it will do it.
Another approach:
MqlDateTime n_struct; datetime n_date = TimeCurrent(); TimeToStruct(n_date, n_struct); printf("%04d%02d%2d%2d%2d%2d", n_struct.year, n_struct.mon, n_struct.day, n_struct.hour, n_struct.min, n_struct.sec);
...
Edit: Probably shorter approach (not tested):
MqlDateTime n_struct; datetime n_date = TimeCurrent(n_struct); printf("%04d%02d%2d%2d%2d%2d", n_struct.year, n_struct.mon, n_struct.day, n_struct.hour, n_struct.min, n_struct.sec);
...

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 there,
When I output datetime to a csv file, it shows 2015.12.10 20:58:39.
Is there any way I can change the format like 20151210205839 , which eliminate the dots and colons?
Thanks