Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Leap Year 2

Status
Not open for further replies.

IanWaterman

Programmer
Jun 26, 2002
3,511
GB
I need to identify Leap years,

I am sure there a simple formula that can analyse a date and know whether it is a leap year or not, just can not think what it is.

I could just take year from the formula, subtract last known leap year and do modulus 4 or remainder 4 if zero then leap year. However, I think Turn of centuries do not obey this rule. Of course I will be long dead before this happens so I will not be sued, I just wanted to do it properly and efficiently.

Ian
 
hi
try this

create a formuls to convert your date to year

@Year
Year({YourDatefield})

then do an other one

@LeapYear
if
Reminder({@Year}) / 4 = 0
then
1
else
0


cheers



pgtek
 
Hi !

Another one can be to get the number of days in february:

day(dateadd("d",-1,cdate(year({table.date}),3,1)))

It will give you 29 for a leap year

/Goran
 
Hear is a formula that will determine if a year is a leap year.


if remainder(Year(your.Date.field),400)= 0 then "Leap"
else if remainder(Year(your.Date.field),100)= 0 then "Non- Leap"
else if remainder(Year(your.Date.field),4)= 0 then "Leap"

Mike
 
The modern calendar excludes century-years unless the whole year is also divisible by four. Thus 1900 was not a leap year, 2000 is and 2100 will not be. You can get this using mbarron's formula, but there's no need for normal business purposes.

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top