>LPARAMETERS ttDateTime as Datetime > >LOCAL ltDateTime as Datetime, lnMinDT as Integer >lnMinDT = MINUTE(ttDateTime) >lnMinDiff = ICASE( BETWEEN(lnMinDT,0,14), 15-lnMinDT ; > , BETWEEN(lnMinDT,15,29), 30-lnMinDT ; > , BETWEEN(lnMinDT,30,44), 45-lnMinDT ; > , 60-lnMinDT) >ltDateTime = ttDateTime + lnMinDiff*60 - SEC(ttDateTime) > >RETURN ltDateTime >Fernando, your function is always pointing to the next interval, isn't it? For instance, {^2016-06-01 10:00:01} returns {^2016-06-01 10:15:00}, and {^2016-06-01 10:15:01} returns {^2016-06-01 10:30:00}.