| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
|
|
LinkBack | Thread Tools |
|
|
||||
|
||||
|
Date format function
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: Code:
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));
}
hope it will be helpfull for someone.Cheers ![]() Kalenzo
__________________
You need proffesional mql coder? Contact me! I will help you! ........................................ http://www.fxservice.eu/ ........................................ |
|
|
||||
|
||||
|
Quote:
![]()
__________________
You need proffesional mql coder? Contact me! I will help you! ........................................ http://www.fxservice.eu/ ........................................ |
| Bookmarks |
| Thread Tools | |
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EA expiration date | jyrik | Expert Advisors - Metatrader 4 | 6 | 04-12-2007 04:32 PM |
| How to put the Expiry date in EA | MACD | Expert Advisors - Metatrader 4 | 1 | 01-26-2007 12:59 PM |
| Need help - importing data in txt format | wazzon | Metatrader 4 | 1 | 05-25-2006 03:34 PM |