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.
-charlievcharliev,
I don't see any problem adding hours minutes secondsto time.
Take this examlpe:
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]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.
charliev,
I don't see any problem adding hours minutes secondsto time.
Take this examlpe:
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]Alert("Current Time = " + TimeToStr(CurTime())+ " : Current Time + 5 Minutes = " + TimeToStr(CurTime()+(60*5)));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
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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