Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rounding DateTime
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00451939
Message ID:
00451956
Views:
33
>I know I've seen an article or thread on rounding numbers, but I can't find them. What I'm looking to do is take a datetime field like 12/11/2000 16:33:00 and round it to the nearest 15 minute period so the result would be 12/11/2000 16:00:00
>
>If anyone can point me to a thread or article I would greatly appreciate it.
>
>Kirk

Here'a another one:
ltvar = datetime()  && get datetime value
* get difference and remainder when dividing by 900 (seconds in 15 minutes)
lndiff = mod(lt - datetime(year(lt),month(lt),day(lt),0,0,0),900)
ltvar =  iif(lndiff>=450, lt+(900-lndiff), lt-lndiff)  && return new datetime
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform