xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DaysInMonth()

Returns the number of days in a month.

Syntax

DaysInMonth( <nMonth>, [<lLeapYear>] ) --> nDaysInMonth

Arguments

<nMonth>
This is a numeric value in the range of 1 to 12 specifying the month.
<lLeapYear>
If <nMonth> is 2 (February), the second, logical parameter indicates a leap year. This can be the return value of IsLeap().

Return

The function returns the number of days in the specified month as a numeric value.

Info

See also:DaysToMonth(), IsLeap(), Month()
Category: CT:DateTime , Date and time
Source:ct\dattime2.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays the days in the current month.

   PROCEDURE Main
      LOCAL dDate := Date()

      ? DaysInMonth( Month(dDate), IsLeap() )
      // result: 28, 29, 30 or 31

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe