CT_MDY

 MDY()
 Returns a date in the "Month DD, YY" format

 Syntax

     MDY([<dDate>]) --> cDate

 Argument

     <dDate>  Designates the date from which to create a string.  The
     default is the system date.

 Returns

     MDY() returns a character string in Month DD, YY, or "Month DD, YYYY"
     format.

 Description

     MDY() returns the date in a character string that contains the day, name
     of month, and year.  The Clipper SET CENTURY ON/OFF switch determines
     whether or not the year is displayed in 2 or 4 digits.

     If the function is called without a parameter, it automatically uses the
     current system date.

 Note

     .  The returned month name always depends on which Clipper
        nations module is in use.  A German or French version of
        Clipper returns the appropriate month names, despite its
        characteristically American display.

 Examples
? "Today :", DATE(), MDY()
dDate := CTOD("02/01/89")
 
? dDate, MDY( dDate )

See Also: DMY()

Advertisements

CT_LastDayOM

LastDayOM()
 Determines the number of days in a month
------------------------------------------------------------------------------
 Syntax

     LastDayOM([<dDate|nMonth>]) --> nDaysInMonth

 Argument

     <dDate|nMonth>  Designates either a date or the number of a month.
     The default is the system date.

 Returns

     LastDayOM() returns the number of days in the month specified by
     <dDate|nMonth>.

 Description

     To administer due dates and other similar dates, it is useful to know
     the number of days that remain in a month.  Specify either the day's
     date or month as a parameter, and you get the length of the month in
     days.  If you subtract the number of days until today's date, you are
     left with the days that remain until month end.

 Note

     .  Without the <dDate|nMonth> parameter, the function
        automatically uses the system date.  If there is an invalid number of
        months, LastDayOM() returns 0 as an error code.

 Example

     How many days remain before the end of the month?
     ? DATE(), LastDayOM()
     ? "There are " + STR(LastDayOM() - DAY( DATE() ), 2) +;
        " days until the end of the month"

See Also: EOM()

CT_IsLeap

 ISLEAP()
 Tests if a specific year is a leap year

 Syntax

     ISLEAP([<dDate>]) --> lLeapYear

 Argument

     <dDate>  Designates whether or not the specified date is 
     in a leap year.  The default is the system date.

 Returns

     ISLEAP() returns .T. when  <dDate> lies in a leap year; 
     otherwise, it returns .F..

 Description

     A number of technical financial calculations need to know 
     if a year has 365 or 366 days.  ISLEAP() determines this.

 Note

     .  When parameters are missing, the function automatically 
        uses the system date.  You must adhere to all rules for 
        leap year tests.
        In the rare occurrence of a century change, the function 
        also returns a correct result.

 Examples :
 ? Date(), IsLeap() 
 ? AddMonth( 12 ), IsLeap(AddMonth( 12)) 
 ? AddMonth( -12 ), IsLeap(AddMonth( -12))
 

CT_DOY()

 DOY()
 Determines the day of the year for a specific date
------------------------------------------------------------------------------
 Syntax

     DOY([<dDate>]) --> nDayOfYear

 Argument

     <dDate>  Designates which date to use to calculate the day of the
     year.  The default is the system date.

 Returns

     DOY() returns a calendar day number that specifies which day of the year
     <dDate> represents.

 Description

     If you frequently work with time periods, then this function is quite
     useful.  DOY() lets you assign a calendar day number to a date that
     relates to the beginning of the year.

 Note

     .  When no date is specified, DOY() uses the system date.
        January 1 is always 1, December 31 is 366 in a leap year; otherwise,
        it is 365.  An empty date returns a 0 result.

 Example
? DATE(), DOY()
dDate := CTOD("12.12.2012")
? dDate, DOY( dDate)

CT_DMY

 DMY()
 Returns a date in "DD Month YY" format
------------------------------------------------------------------------------
 Syntax

     DMY([<dDate>], [<lMode>]) --> cDate

 Arguments

     <dDate>  Designates the date from which to create a string.  The
     default is the system date.

     <lMode>  Designates whether to insert a period (.) after the day
     (see Examples).  The default is no period (.F.).

 Returns

     DMY() returns a character string in "DD[.] Month YY" format or "DD[.]
     Month YYYY" format.

 Description

     Use DMY() to return the date as a character string using the day, name
     of month, and year.  The CA-Clipper SET CENTURY ON/OFF switch determines
     whether or not the year is displayed in two or four digits.  If the
     <lMode> parameter is designated .T., the function builds in a "." after
     the day designation. If no date is designated as a parameter, the
     function automatically uses the current system date.

 Note

     .  The month name returned depends on which CA-Clipper nations
        module is in use.

 Examples

     .  Display the system date (1/1/89):

        SET CENTURY OFF
        ? DMY()                            // 1 January 89

     .  With ".":

        ? DMY(.T.)                         // 1. January 89

     .  Display a different date:

        SET CENTURY ON
        ? DMY(CTOD("02/01/89"), .T.)       // 1. February 1989

See Also: MDY()

CT_CToMonth()

 CTOMONTH()
 Converts the name of the month into a corresponding number
------------------------------------------------------------------------------
 Syntax

     CTOMONTH(<cMonth>) --> nMonth

 Argument

     <cMonth>  Designates the name of one of the 12 months.

 Returns

     CTOMONTH() returns the number for the designated month name.

 Description

     Use CTOMONTH() to change the name of a month into a number.  January
     corresponds to 1, February 2, etc..  If the function returns a 0 value,
     then an invalid parameter has been passed.  If you shorten the month
     name, use explicit abbreviations to return an accurate return value.

 Notes

     .  Uppercase and lowercase letters do not affect the name of the
        month.

     .  The function's operation depends on the country-specific
        adaptation of your CA-Clipper compiler.  With an English version of
        CA-Clipper, only English month names are recognized.

 Examples

     .  Show the number for January:

        ? CTOMONTH("January")      // Result: 1

     .  Show several ways to determine the month number for August:

        ? CTOMONTH("AUGUST")       // Result: 8
        ? CTOMONTH("August")       // Result: 8
        ? CTOMONTH("Au")           // Result: 8

     .  The number for April:

        ?CTOMONTH("A")             // Result: 4