Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date Math
Message
De
09/03/2004 12:11:04
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
09/03/2004 10:22:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00884427
Message ID:
00884472
Vues:
40
>Is there a simple way to manage leap year when doing calculations based on dates? The program I am working on processes records on an annual basis. Sometimes the records are terminated before the end of a full year and sometimes they are increased or decreased before a full year. Because of leap year some years have 364 days and others have 365. Does FoxPro have a built in way to deal with this, or is there an easy way to program for this anomaly?

You could ask VFP if that's a leap year :
lIsLeap = !empty(date(m.Year,2,29))
Do simple math to check if that's a leap year :
lIsLeap = m.Year % 400 = 0 or (m.Year % 4=0 and m.Year % 100 # 0)
as has been told already or directly ask VFP how many days in a given year :
lnDays = date(m.Year,12,31)-date(m.Year-1,12,31)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform