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 Folks!
When I was debugging my EA orders I wanted to print when they was created. But the OrderOpenTime() function returns timestamp number so it is hard to read the date from it without any tool or conversion. So I made a nice function that convert eg. 12313132 into a string like 2006.03.12 12:33 so it can be read very easy.
Here it is:
string dateFormat(int timestamp)
{
string m,d,h,mi;
int month = TimeMonth(timestamp);
int day = TimeDay(timestamp);
int hour = TimeHour(timestamp);
int minute = TimeMinute(timestamp);
if(month<10)
m = "0"+month;
else
m = month;
if(day<10)
d = "0"+day;
else
d = day;
if(hour<10)
h = "0"+hour;
else
h = hour;
if(minute<10)
mi = "0"+minute;
else
mi = minute;
return(StringConcatenate(TimeYear(timestamp),".",m,".",d," ",h,":",mi));
}
U can use it as u want hope it will be helpfull for someone.
Cheers
Kalenzo