FT_DAYTOBOW

FT_DAYTOBOW()
 Calculate no. of days between date and beginning of week

 Syntax

      FT_DAYTOBOW( [ <dGivenDate> ] ) -> nDays

 Arguments

     <dGivenDate> is any valid date in any valid date format.
     Defaults to current date if not supplied.

 Returns

     A positive number of days to beginning of week, range 0 to 6.

 Description

     FT_DAYTOBOW() returns the number of days to the beginning of the
     week.  Normally this will be one less than the value that
     would be returned by the Clipper function DOW(), unless the
     day for the beginning of the week has been changed with
     FT_DATECNFG().

 Examples

     dDate := CTOD( "09/15/90" )

     ? DOW( dDate )               // 7
     ? CDOW( dDate )              // Saturday
     ? FT_DAYTOBOW( dDate )       // 6

     // change beginning of week to Friday  (yeah!)
     FT_DATECNFG( , 6 )
     ? DOW( dDate )               // 7
     ? CDOW( dDate )              // Saturday
     ? FT_DAYTOBOW( dDate )       // 1

 Source: DAYTOBOW.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_DATECNFG() FT_ACCTWEEK() FT_WEEK()

FT_DAYOFYR

FT_DAYOFYR()
 Return calendar, fiscal or accounting day data

 Syntax

      FT_DAYOFYR( [ <dGivenDate> ], [ <nDayNum> ], [ <lIsAcct> ] )
             -> aDateInfo

 Arguments

     <dGivenDate> is any valid date in any valid format.  Defaults
     to current system date if not supplied.

     <nDayNum> is a number from 1 to 371, signifying a day of a year.
     Defaults to current day if not supplied.

     <lIsAcct> is a logical which specifies the type of year to base
     the return value on:  .F. = calendar or fiscal year,
     .T. = accounting year.

 Returns

     A three element array containing the following data:

        If <nDayNum> is specified:

        aDateInfo[1] - The date of the specified day number
        aDateInfo[2] - The beginning date of the year
        aDateInfo[3] - The ending date of the year

        If <nDayNum> is not specified:

        aDateInfo[1] - The year and day as a character string "YYYYDDD"
        aDateInfo[2] - The beginning date of the year
        aDateInfo[3] - The ending date of the year

 Description

     FT_DAYOFYR() returns an array containing data about a day in the
     calendar or fiscal year containing the given date.

     The beginning of year date defaults to January 1st but may be
     changed with FT_DATECNFG().

 Examples

     aDateInfo := FT_DAYOFYR( CTOD("03/31/91") )
     ? aDateInfo[1]        // 1991090    (90th day of year 1991)
     ? aDateInfo[2]        // 01/01/91
     ? aDateInfo[3]        // 12/31/91

     aDateInfo := FT_DAYOFYR( , 90 )    // assume current date is 3/31/91
     ? aDateInfo[1]        // 03/31/91    (90th day of year)
     ? aDateInfo[2]        // 01/01/91
     ? aDateInfo[3]        // 12/31/91

     aDateInfo := FT_DAYOFYR( , 90, .T. )
     ? aDateInfo[1]        // 03/29/91    (90th day of accounting year)
     ? aDateInfo[2]        // 12/30/90    (1st day of accounting year)
     ? aDateInfo[3]        // 12/28/91    (last day of accounting year)

 Source: DAYOFYR.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_DATECNFG()

FT_DATECNFG

FT_DATECNFG()
 Set beginning of year/week for FT_ date functions

 Syntax

      FT_DATECNFG( [ <cFYStart> ], [ <nDow> ] ) -> aDateInfo

 Arguments

     <cFYStart> is a character date string in the user's system date
     format, i.e., the same as the user would enter for CTOD().  If
     this argument is NIL, the current value is unchanged.

     Note: The year portion of the date string must be present and
     be a valid year; however, it has no real meaning.

     <nDow> is a number from 1 to 7 (1 = Sunday) indicating the
     desired start of a work week.  If this argument is NIL,
     the current value is unchanged.

 Returns

     A 2-element array containing the following information:

        aDateInfo[1] - an ANSI date string indicating the beginning
                       date of the year.  Only the month and day are
                       meaningful.

        aDateInfo[2] - the number of the first day of the week
                       (1 = Sunday)

 Description

     FT_DATECNFG() is called internally by many of the date functions
     in the library to determine the beginning of year date and
     beginning of week day.

     The default beginning of the year is January 1st and the default
     beginning of the week is Sunday (day 1).  Either or both of these
     settings may be changed by calling FT_DATECNFG() with the proper
     arguments.  They will retain their values for the duration of the
     program or until they are changed again by a subsequent call to
     FT_DATECNFG().

     It is not necessary to call FT_DATECNFG() unless you need to
     change the defaults.

     FT_DATECNFG() affects the following library functions:

       FT_WEEK()       FT_ACCTWEEK()       FT_DAYTOBOW()
       FT_MONTH()      FT_ACCTMONTH()      FT_DAYOFYR()
       FT_QTR()        FT_ACCTQTR()        FT_ACCTADJ()
       FT_YEAR()       FT_ACCTYEAR()

 Examples

       // Configure library date functions to begin year on
       //  July 1st.

       FT_DATECNFG("07/01/80")    // year is insignificant

       // Examples of return values:

       //  System date format: American           aArray[1]    aArray[2]

       aArray := FT_DATECNFG()              //  '1980.01.01'     1 (Sun.)
       aArray := FT_DATECNFG('07/01/80')    //  '1980.07.01'     1 (Sun.)
       aArray := FT_DATECNFG('07/01/80', 2) //  '1980.07.01'     2 (Mon.)
       aArray := FT_DATECNFG( , 2 )         //  '1980.01.01'     2 (Mon.)

       //  System date format: British

       aArray := FT_DATECNFG('01/07/80', 2) //  '1980.07.01'     2 (Mon.)

 Source: DATECNFG.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_ACCTADJ()