How Do I Increment a Time Value? (Magic xpa 4.x)
Time in Magic xpa is stored internally as an integer representing the number of seconds since midnight. So, to increment a time, you can just add some number of seconds to it. For instance:
Time() + 5
will return a time 5 seconds from now.
However, if you want to increment the time by some number of hours or minutes, you would use the AddTime() function. It takes four parameters, as shown below:
AddTime(Time, Hours, Minutes, Seconds)
|
Time
|
The base time to add/subtract from
|
Hours
|
Number of hours to add or subtract
|
Minutes
|
Number of minutes to add or subtract
|
Seconds
|
Number of seconds to add or subtract
|
So, if you create an expression:
AddTime(B,-1,0,0)
would subtract an hour from the base time. So if you started with 14:08:03, then the AddTime() function shown above would return 13:08:03.
The Online and Rich Client Samples projects (program DT05 and RDT05)