>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