Home  |  Delphi .net Home  |  System.DateTime  |  IsLeapYear Method
IsLeapYear  
Method  
Determines whether a year is a leap year
DateTime Structure
System NameSpace
CF1.  Function IsLeapYear ( Year : Integer; ) : Boolean; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns true if the given Year is a leap year.
Microsoft MSDN Links
System
System.DateTime
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  days : Integer;

begin
  if System.DateTime.IsLeapYear(2000)  // 2000 was a leap year
  then Console.WriteLine('February 2000 was a leap year')
  else Console.WriteLine('February 2000 was a leap year');

  Console.ReadLine;
end.
Show full unit code
  February 2000 was a leap year
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author