Re: Round the time by Paul
Paul
Mon Feb 13 12:55:24 CST 2006
That would work fine always, if a datetime were an integral value, i.e., an
exact number of seconds.
But I have run into situations that demonstrate that it is not. In other
words, sometimes a field containing {^2006/2/13 10:50:15} can be less than
or greater than one containing {^2006/2/13 10:50:15}. I'm not making that
up! I actually had to round the value to the nearest whole number of seconds
before I could make an equality comparison.
It's been a while now, but I seem to remember it happening when I picked up
a datetime from an external source, Excel or Access maybe.
"Christian Ehlscheid" <christian@vfp2c.com> wrote in message
news:%23vJRzEgLGHA.2276@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> something like this?!
>
> FUNCTION YourRoundTime(ldDateTime)
> LOCAL lnSecs
> lnSecs = SEC(ldDateTime)
> IF lnSecs < 30
> RETURN ldDateTime - lnSecs
> ELSE
> RETURN ldDateTime + 60 - lnSecs
> ENDIF
> ENDFUNC
>
> Regards
> Christian