Welcome, Guest. Please Login or Register.
eccoMAGIC Forums
03/29/24 at 02:14:03
News: "Breathtaking" (Check out the new MagicView release at EccoTools.com)
Home Help Search Login Register


Pages: 1
Send Topic Print
  Rating
Rate:
Rating:
Rating: 0.00
Votes: 0

5
4
3
2
1












5
4
3
2
1


1


2


3


4


5


6


7


8


9


10

Easy way to add / subtract hours (like "today()+X" for days) (Popularity: 7458 )
Philster
EccoMagic Apprentice
*


I Love Ecco!

Posts: 9
Show the link to this post Easy way to add / subtract hours (like "today()+X" for days)
02/02/08 at 02:09:36
 
Say, "now()+5h" would add 5 hours to the current time, also changing the date if it goes beyond midnight / new year etc. Subtracting should work the same way.
 
I know this can probably be done through string manipulation in some way, but I'm sure that would be rather complicated.
 
If anyone already has a script / expression that does this, could you please post it?
 
Many thanks
 
Phil
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Easy way to add / subtract hours (like "today()+X" for days)
Reply #1 - 02/02/08 at 16:31:59
 
check out the eccoWiki on the date expressions.
 
i think you can do it easily that way.
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Philster
EccoMagic Apprentice
*


I Love Ecco!

Posts: 9
Show the link to this post Re: Easy way to add / subtract hours (like "today()+X" for days)
Reply #2 - 02/04/08 at 08:39:34
 
Thanks for your reply.
 
If you mean the below, it only goes down to the day level, so does not include hours. If you had something else in mind could you please be more specific / post a URL within the Wiki? Thanks. Phil
 
Relative date expression may be used to calulate a date in the future
 
    * +(-)xd plus or minus "x" days (eg. +5d, -27d)
    * +(-)xw plus or minus "x" weeks
    * +(-)xm plus or minus "x" months
    * +(-)xy plus or minus "x" years
    * -2y9m 6w2d (calculates from "today")
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Easy way to add / subtract hours (like "today()+X" for days)
Reply #3 - 02/04/08 at 15:21:51
 

ok,
 
isolate the time portion of the date  (if any)
 
200610020920
 
 
add the desired amount of time to it,
 
if is > 2400 then add 1 to date,
otherwise just make date equal to new value.
 
 
 
this is doable even as a simple rule,  actually.
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Pages: 1
Send Topic Print