DelphiBasics
DaysInAMonth
Function
Gives the number of days in a month DateUtils unit
 function DaysInAMonth ( const Year, Month : Word ) : Word;
Description
The DaysInAMonth function gives the number of days in a given Year and Month.
Related commands
DaysBetween Gives the whole number of days between 2 dates
DaysInAYear Gives the number of days in a year
DaySpan Gives the fractional number of days between 2 dates
MinsPerDay Gives the number of minutes in a day
MonthDays Gives the number of days in a month
SecsPerDay Gives the number of seconds in a day
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : How many days in February 2000 ?
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  DateUtils,   // Unit containing the DaysInAMonth command
  SysUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

begin
  // How many days in February 2000 ?
  ShowMessage('Days in February 2000 = '+
              IntToStr(DaysInAMonth(2000, 2)));
end;
 
end.
Hide full unit code
   Days in February 2000 = 29
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page