Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rounding DateTime
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00451939
Message ID:
00451956
Vues:
34
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform