[Overview][Constants][Procedures and functions][Index] Reference for unit 'DateUtils' (#rtl)

DaysInMonth

Return the number of days in the month in which a date occurs.

Declaration

Source position: dateutil.inc line 100

function DaysInMonth(

  const AValue: TDateTime

):Word;

Arguments

AValue

  

Date in month of which to calculate the number of days.

Function result

Number of days in the month in which AValue occurs.

Description

DaysInMonth returns the number of days in the month in which AValue falls. The return value takes leap years into account.

See also

WeeksInAYear

  

Return the number of weeks in a given year

WeeksInYear

  

return the number of weeks in the year, given a date

DaysInYear

  

Return the number of days in the year in which a date occurs.

DaysInAYear

  

Number of days in a particular year.

DaysInAMonth

  

Number of days in a month of a certain year.

Example

Program Example16;

{ This program demonstrates the DaysInMonth function }

Uses SysUtils,DateUtils;

Var
  Y,M : Word;

Begin
  For Y:=1992 to 2010 do
    For M:=1 to 12 do
      Writeln(LongMonthNames[m],' ',Y,' has ',DaysInMonth(EncodeDate(Y,M,1)),' days.');
End.

Documentation generated on: Jun 23 2021