Previous Topic

Next Topic

Book Contents

Book Index

%%$LEAP

The %%$LEAP function determines whether a specified Gregorian date (with a 4-character year) falls in a leap year. If the date is in a leap year, the variable resolves to 1. If the date is not in a leap year, the variable resolves to 0. The format of the %%$LEAP function is:

%%$LEAP date

where date must be (or resolve to) a date in format yyyymmdd.

Leap years are years whose last two digits are evenly divisible by 4, excluding those years that are divisible by 100 but not by 400. Therefore, 2000 is a leap year but the years 2100, 2200 and 2300 are not.

Example

//* %%SET %%A=%%$LEAP %%$ODATE

%%A is assigned a value of 1 for dates in the year 2000 and 0 for dates in the year 2001.

Parent Topic

Functions