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

 
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 secondsto time.

Take this examlpe:

Alert("Current Time = " + TimeToStr(CurTime())+ " : Current Time + 60 Seconds = " + TimeToStr(CurTime()+60));[/PHP]

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.

 
Mohammed:
charliev,

I don't see any problem adding hours minutes secondsto time.

Take this examlpe:

Alert("Current Time = " + TimeToStr(CurTime())+ " : Current Time + 60 Seconds = " + TimeToStr(CurTime()+60));[/PHP]

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.

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

Reason: