Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-05-2007, 09:53 PM
Kurka Fund's Avatar
Senior Member
 
Join Date: Sep 2006
Location: San Diego
Posts: 139
Kurka Fund is on a distinguished road
DateTime Question

I am trying to convert two string values to a datetime value but I cant get it right can anyone help...

My two string values are:

string aDate = eDate[n];
string aTime = eTime[n];

Wnat I need is

datetime aDateTime[n] = StrToTime(eDate[n]+eTime[n]);

just does not seem to work any suggestions?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-06-2007, 12:48 AM
ryanklefas's Avatar
Senior Member
 
Join Date: Apr 2006
Location: USA
Posts: 440
ryanklefas is on a distinguished road
Quote:
Originally Posted by Kurka Fund View Post
I am trying to convert two string values to a datetime value but I cant get it right can anyone help...

My two string values are:

string aDate = eDate[n];
string aTime = eTime[n];

Wnat I need is

datetime aDateTime[n] = StrToTime(eDate[n]+eTime[n]);

just does not seem to work any suggestions?
I'd try adding a space between the date and time strings to get the formatting correct. I'm not sure if it will work:

datetime aDateTime[n] = StrToTime(eDate[n]+" "+eTime[n]);
__________________
"Don't work harder, work smarter." -- my Java professor

Coder for Hire:
http://www.firecell-fx.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-06-2007, 03:42 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
Deleted; Michel is quite right.

Last edited by ralph.ronnquist; 07-06-2007 at 02:09 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-06-2007, 09:33 AM
Senior Member
 
Join Date: Feb 2006
Posts: 513
Michel is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist View Post
Or maybe:
PHP Code:
datetime aDateTime[n] = StrToTimeeDate[n] ) + StrToTimeeTime[n] ); 
This is certainly wrong, the use of StrToTime() is :
datetime StrToTime( string value)
Converts string in the format "yyyy.mm.dd hh:mi" to datetime type (the amount of seconds that have passed since 1 Jan., 1970).

So the suggestion of Ryan should work if eDate[] and eTime[] are right formated (yyyy.mm.dd) and (hh:mi)
PHP Code:
datetime aDateTime[n] = StrToTime(eDate[n]+" "+eTime[n]); 

Last edited by Michel; 07-06-2007 at 09:35 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-07-2007, 01:21 AM
Kurka Fund's Avatar
Senior Member
 
Join Date: Sep 2006
Location: San Diego
Posts: 139
Kurka Fund is on a distinguished road
worked thanks you guys are awesome...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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
Playing with datetime... lucidlamp Metatrader 4 0 06-28-2007 04:16 PM
question evgeni1980 Questions 4 11-27-2006 01:32 PM
EA question yaniv_av Expert Advisors - Metatrader 4 1 11-14-2006 12:10 PM
How to add a day at a datetime variable ? Pierre2006 Metatrader 4 2 09-22-2006 02:05 PM


All times are GMT. The time now is 11:54 PM.



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