[AccessD] Rounding time

jwcolby jwcolby at colbyconsulting.com
Mon Nov 15 08:36:55 CST 2010


This will round a passed in DateTime to the nearest 5, 10, 15 etc minutes.

I wanted to automatically round a time to the nearest 5 minute mark (for billing).  My form 
automatically puts now() in the from / to as I start to enter a billing item and I then edit it as 
needed.  By doing this check on the AfterUpdate, it will automatically round to the nearest 5 minutes.

John W. Colby
www.ColbyConsulting.com

On 11/14/2010 9:05 PM, jwcolby wrote:
>
> '
> '1440
> '____ = 5 minute round
> 'X
> Function RoundTime(vRoundTime As Date) As Date
> 'Const cintMult As Integer = 96 '15 minute round
> 'Const cintMult As Integer = 144 '10 minute round
> Const cintMult As Integer = 288 '5 minute round
>       RoundTime = CVDate(Int(vRoundTime * cintMult + 0.5) / cintMult)
>
> End Function
>
>



More information about the AccessD mailing list