Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course


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
 
Old 09-05-2006, 01:19 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 693
Kalenzo is on a distinguished road
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));
}
U can use it as u want hope it will be helpfull for someone.
Cheers

Kalenzo
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-05-2006, 01:22 PM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 287
phoenix is on a distinguished road
but .. what about TimeToStr() function?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 
Old 09-05-2006, 01:26 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 693
Kalenzo is on a distinguished road
Quote:
Originally Posted by phoenix
but .. what about TimeToStr() function?
U right, sometimes I'm missing something which goes without saying...
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
 

Bookmarks
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

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


All times are GMT. The time now is 11:51 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.