KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using the Mod command to "wrap" time around at 24Hrs
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: August 17, 2001

You will notice that if you add a minute(00:01:00) to 11:59pm(23:59:00), the result is 24:00:00. Of course, 24:00:00 does not correspond to 12:00am.

To get around this, use the MOD command. Since MOD works on Integers and Time is an integer value of seconds, we can use it to make the time "wrap" around at 24Hrs.

For example:

C_TIME(myTimeVar)
myTimeVar:=?24:00:00?
myTimeVar:=Mod(myTimeVar;?24:00:00?)


The result of myTimeVar is 00:00:00 which corresponds to 12:00am.