Hi
Is there a way to round the time?
Actually I want to trim the seconds rounding properly the time.
Is there a function or should I make one?

10/2/2006 6:50:15 --> 10/2/2006 6:50:00 or 10/2/2006 6:50
10/2/2006 6:50:49 --> 10/2/2006 6:51:00 or 10/2/2006 6:51

Demetrios, Greece

Re: Round the time by Christian

Christian
Thu Feb 09 23:16:54 CST 2006

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

Re: Round the time by Fred

Fred
Sat Feb 11 00:51:25 CST 2006

SET SECONDS OFF if you only need to clip the seconds for display purposes.

--
Fred
Microsoft Visual FoxPro MVP


"Demetrios Panayotakopoulos" <d.g.pan_@my.hol.gr> wrote in message
news:eUmlA4fLGHA.1124@TK2MSFTNGP15.phx.gbl...
> Hi
> Is there a way to round the time?
> Actually I want to trim the seconds rounding properly the time.
> Is there a function or should I make one?
>
> 10/2/2006 6:50:15 --> 10/2/2006 6:50:00 or 10/2/2006 6:50
> 10/2/2006 6:50:49 --> 10/2/2006 6:51:00 or 10/2/2006 6:51
>
> Demetrios, Greece
>



Re: Round the time by dpan

dpan
Fri Feb 10 02:13:28 CST 2006

Thank you so much Christian.

Regards.
Demetrios, Greece

"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




Re: Round the time by Demetrios

Demetrios
Mon Feb 13 08:19:49 CST 2006

(I was pretty sure I had replied but I do not see my replay, so I resend
one.)

Christian,
Thank you so much. It works.

Demetrios, Greece


"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






Re: Round the time by Demetrios

Demetrios
Mon Feb 13 08:22:33 CST 2006

Fred,

Thanks. I had tried that - in the first place, but I had failed.
Though that what I wanted was rounding.

Demetrios, Greece

"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:%233qBDetLGHA.3984@TK2MSFTNGP14.phx.gbl...
> SET SECONDS OFF if you only need to clip the seconds for display purposes.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Demetrios Panayotakopoulos" <d.g.pan_@my.hol.gr> wrote in message
> news:eUmlA4fLGHA.1124@TK2MSFTNGP15.phx.gbl...
>> Hi
>> Is there a way to round the time?
>> Actually I want to trim the seconds rounding properly the time.
>> Is there a function or should I make one?
>>
>> 10/2/2006 6:50:15 --> 10/2/2006 6:50:00 or 10/2/2006 6:50
>> 10/2/2006 6:50:49 --> 10/2/2006 6:51:00 or 10/2/2006 6:51
>>
>> Demetrios, Greece
>>
>
>



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