Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date Math
Message
From
09/03/2004 12:11:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/03/2004 10:22:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00884427
Message ID:
00884472
Views:
39
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform