From/In range

from( value, range )

Check if the value is between 0 and the range.

Description

from( value, range )

This function is commonly used with the time() function to evaluate a time range.

Parameters

value Value to evaluate
range Range to compare to

Return value

If the value is negative or larger than range the from() function returns 0. Otherwise the function returns the difference between range and value.

Example usage

from(35, 40)  // returns 5 (=40-35)

from(42, 40)  // returns 0

from(-4, 40)  // returns 0

from(time(17,00), 30)   // Will return a positive number between 17:00 and 17:29 (inclusive). Otherwise returns 0.