Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > 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 03-05-2006, 08:25 PM
Junior Member
 
Join Date: Jan 2006
Posts: 25
charliev is on a distinguished road
Question Date/Time functions missing?

Hello everyone,

Arien't there any date/time functions to add and subtract (hours, minutes, seconds) to derive a new date/time?

For instance, if I wanted to add 360 minutes to a fixed date/time to get a future date/time how would I do it (without having to code the whole thing)?

Thanks for the help! All replies appreciated.

-charliev
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-05-2006, 10:08 PM
Mohammed's Avatar
Senior Member
 
Join Date: Mar 2006
Posts: 119
Mohammed is on a distinguished road
Lightbulb

Quote:
Originally Posted by charliev
Hello everyone,

Arien't there any date/time functions to add and subtract (hours, minutes, seconds) to derive a new date/time?

For instance, if I wanted to add 360 minutes to a fixed date/time to get a future date/time how would I do it (without having to code the whole thing)?

Thanks for the help! All replies appreciated.

-charliev
charliev,

I don't see any problem adding hours minutes seconds to time.
Take this examlpe:

PHP Code:
Alert("Current Time = " TimeToStr(CurTime())+ " : Current Time + 60 Seconds = " TimeToStr(CurTime()+60)); 

This code will add 1 minute to the current time.
As you can see you adding in seconds
if you want to add 5 minutes you will use this code:

PHP Code:
Alert("Current Time = " TimeToStr(CurTime())+ " : Current Time + 5 Minutes = " TimeToStr(CurTime()+(60*5))); 
I think there's no need to code a function for that, and I'm sorry if I misunderstand you.
__________________
There is a fine line between freedom of expression and hate literature.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-06-2006, 12:03 PM
Junior Member
 
Join Date: Jan 2006
Posts: 25
charliev is on a distinguished road
Quote:
Originally Posted by Mohammed
charliev,

I don't see any problem adding hours minutes seconds to time.
Take this examlpe:

PHP Code:
Alert("Current Time = " TimeToStr(CurTime())+ " : Current Time + 60 Seconds = " TimeToStr(CurTime()+60)); 

This code will add 1 minute to the current time.
As you can see you adding in seconds
if you want to add 5 minutes you will use this code:

PHP Code:
Alert("Current Time = " TimeToStr(CurTime())+ " : Current Time + 5 Minutes = " TimeToStr(CurTime()+(60*5))); 
I think there's no need to code a function for that, and I'm sorry if I misunderstand you.
Thanks for your reply Mohammed,

You're right, converting to seconds is no problem (I used a simple example). Finding the amount of time in-between dates involves a little bit of code, agian because you're dealing in seconds. I'm used to functions like "DateAdd".

You answered my question though, you must convert to seconds to do date/time arithmetic.

-charliev
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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me.... about date and time, thks gsosay Setup Questions 0 04-11-2007 11:13 AM
What lines are missing, please matrixebiz Expert Advisors - Metatrader 4 2 12-06-2006 01:44 AM
Am I stupid or just missing something? DollarShort Metatrader 4 9 07-17-2006 07:04 AM
Some questions about Time (data & functions). pete7 Metatrader 4 3 05-15-2006 10:14 AM


All times are GMT. The time now is 08:35 AM.



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