xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

DaysToMonth()

Returns the number of days from first January to the beginning of a month.

Syntax

DaysToMonth( <nMonth>, [<lLeapYear>] ) --> nDays

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 from first January to the first day of the specified month as a numeric value.

Info

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

Example

// The example displays results of DaysToMonth()

   PROCEDURE Main
      LOCAL dDate := StoD( "20061101" )

      ? DaysToMonth( 1 )         // result: 0
      ? DaysToMonth( 3 )         // result: 59
      ? DaysToMonth( 3, .T. )    // result: 60

      ? DaysToMonth( 11 )        // result: 304

      ? DoY( dDate )             // result: 305
   RETURN

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