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()


 

FT_CIV2MIL

FT_CIV2MIL()
 Convert usual civilian format time to military time.

 Syntax

      FT_CIV2MIL( <cCIVTIME> ) -> cMILTIME

 Arguments

     <cCIVTIME>  character string of form hh:mm (am,pm,n or m),
        where 0<hh<12.

 Returns

     <cMILTIME>  character string of form hhmm, where 0<=hh<24.

 Description

     Converts time from 12-hour civilian format to military.

 Examples

     FT_CIV2MIL( " 5:40 pm" ) -> 1740

     FT_CIV2MIL( " 5:40 am" ) -> 0540

     FT_CIV2MIL( "12:00 n" ) -> 1200

     FT_CIV2MIL( "12:00 m" ) -> 0000

     Caution:  leading blanks are irrelevant; p,a,n,m must be preceded by
               one and only one space.

 Source: MILTIME.PRG

 Author: Alexander B. Spencer

See Also: FT_MIL2CIV() FT_SYS2MIL() FT_MIL2MIN() FT_MIN2MIL()



FT_CALENDAR

FT_CALENDAR()
 Display date/time calendar, find a date, return calendar data.

 Syntax

      FT_CALENDAR ( [ <nRow> ], [ <nCol> ], [ <cColor> ], [ <lShadow> ] ,
                    [ <lShowHelp> ] ) -> aRetVal

 Arguments

     <nRow> is an optional screen row for calendar display,
            default row 1.

     <nCol> is an optional screen col for calendar display,
            default col 63.

     <cColor> is an optional color string for displayed messages,
              default is bright white text over green background.

     <lShadow> is an optional logical variable. If true (.T.),
               it uses FT_SHADOW() to add a transparent shadow
               to the display, default (.F.).

     <lShowHelp> is an optional logical variable. If true, uses
                 FT_XBOX to display  a four line help message
                 if the F1 key is pressed, default (.F.).

 Returns

     aRetVal  is an 8 element array containing date, month, day, year,
              month (in character format), day of the week, julian day
              and current time.

 Description

     FT_CALENDAR() simply displays today's date, time and julian
     day in a two line display with an optional box shadow. Cursor keys may
     be used to page through the calendar by day, week, month or year
     increments. Returns an 8 element array of calendar data:

     Element  Value
     [1]      Date in current date format.
     [2]      Numeric month number.
     [3]      Numeric day number.
     [4]      Numeric year number.
     [5]      Month in character format.
     [6]      Day of the week in character format.
     [7]      Numeric Julian day.
     [8]      Current time in time format.

     WARNING: FT_CALENDAR uses FT_SHADOW and FT_XBOX
              from the Nanforum Toolkit!

 Examples

   LOCAL aRetVal[8]
   CLS
   aRetVal := FT_CALENDAR (10,40,'W+/RB',.T.,.T.)
   ?aRetVal[1]      // Result: 04/20/91
   ?aRetVal[2]      // Result:   4
   ?aRetVal[3]      // Result:  20
   ?aRetVal[4]      // Result:  1991
   ?aRetVal[5]      // Result: April
   ?aRetVal[6]      // Result: Saturday
   ?aRetVal[7]      // Result:        110
   ?aRetVal[8]      // Result: 12:45:20

 Source: CALENDAR.PRG

 Author: Isa Asudeh

See Also: FT_DAYOFYR()

 

FT_ADDWKDY

FT_ADDWKDY()
 Return true number of days to add given number of workdays

 Syntax

      FT_ADDWKDY( <dStart>, <nWorkDays> ) -> nTrueDays

 Arguments

     <dStart> = date to start adding from
     <nWorkDays> = number of workdays to add

 Returns

     <nTrueDays> = Number of actual days to add to <dStart> in
                   order to add the required <nWorkDays>

 Description

      Let's say you are given the problem:

         "All invoices are due 10 working days from the date they
         are printed.  Please display the due date on the invoice."

      When is the due date?  Assuming you are printing the invoices
      today, your answer is:

           dDueDate := DATE() + ft_addWkDay( DATE(), 10 )

      A work day is defined as Monday through Friday.  Unfortunately
      this routine does _not_ account for holidays.

      This documentation was written by Glenn Scott so if it's wrong,
      blame him.

 Examples

      // Postdate 5 working days from the first of January
      dPost := CTOD("01/01/91")
      dPost += FT_ADDWKDY( dPost, 5 )   // returns 7 true days
      ? dPost                          //  01/08/91

 Source: WDA.PRG

 Author: Eric Splaver

See Also: FT_WORKDAYS()


			

FT_ACCTYEAR

FT_ACCTYEAR()
 Return accounting year data

 Syntax

      FT_ACCTYEAR( [ <dGivenDate> ] ) -> aDateInfo

 Arguments

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

 Returns

     A three element array containing the following data:

        aDateInfo[1] - The year as a character string "YYYY"
        aDateInfo[2] - The beginning date of the accounting year
        aDateInfo[3] - The ending date of the accounting year

 Description

     FT_ACCTYEAR() creates an array containing data about the
     accounting year containing the given date.

     An accounting period has the following characteristics:

     If the first week of the period contains 4 or more 'work'
     days, it is included in the period; otherwise, the first
     week was included in the prior period.

     If the last week of the period contains 4 or more 'work'
     days it is included in the period; otherwise, the last week
     is included in the next period.  This results in 13 week
     'quarters' and 4 or 5 week 'months'.  Every 5 or 6 years, a
     'quarter' will contain 14 weeks and the year will contain 53
     weeks.

 Examples

     // get info about accounting year containing 9/15/90
     aDateInfo := FT_ACCTYEAR( CTOD("09/15/90") )
     ? aDateInfo[1]   //  1990
     ? aDateInfo[2]   //  12/31/89    beginning of year
     ? aDateInfo[3]   //  12/29/90    end of year

 Source: ACCTYEAR.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_DATECNFG() FT_ACCTWEEK() FT_ACCTMONTH() FT_ACCTQTR()

 

FT_ACCTWEEK

FT_ACCTWEEK()
 Return accounting week data
------------------------------------------------------------------------------

 Syntax

      FT_ACCTWEEK( [ <dGivenDate> ], [ <nWeekNum> ] ) -> aDateInfo

 Arguments

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

     <nWeekNum> is a number from 1 to 52 signifying a week.
     Defaults to current week if not supplied.

 Returns

     A three element array containing the following data:

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

 Description

     FT_ACCTWEEK() returns an array containing data about the
     accounting week containing the given date.

     An accounting period has the following characteristics:

     If the first week of the period contains 4 or more 'work'
     days, it is included in the period; otherwise, the first
     week was included in the prior period.

     If the last week of the period contains 4 or more 'work'
     days it is included in the period; otherwise, the last week
     is included in the next period.  This results in 13 week
     'quarters' and 4 or 5 week 'months'.  Every 5 or 6 years, a
     'quarter' will contain 14 weeks and the year will contain 53
     weeks.

 Examples

     // get info about accounting week containing 9/15/90
     aDateInfo := FT_ACCTWEEK( CTOD("09/15/90") )
     ? aDateInfo[1]   //  199037       (37th week)
     ? aDateInfo[2]   //  09/09/90     beginning of week 37
     ? aDateInfo[3]   //  09/15/90     end of week 37

     // get info about accounting week 25 in year containing 9/15/90
     aDateInfo := FT_ACCTWEEK( CTOD("09/15/90"), 25 )
     ? aDateInfo[1]   //  199025
     ? aDateInfo[2]   //  06/17/89   beginning of week 25
     ? aDateInfo[3]   //  06/23/90   end of week 25

 Source: ACCTWEEK.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_DATECNFG() FT_ACCTMONTH() FT_ACCTQTR() FT_ACCTYEAR()

 

FT_ACCTQTR

FT_ACCTQTR()
 Return accounting quarter data
------------------------------------------------------------------------------

 Syntax

      FT_ACCTQTR( [ <dGivenDate> ], [ <nQtrNum> ] ) -> aDateinfo

 Arguments

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

     <nQtrNum> is a number from 1 to 4 signifying a quarter.
     Defaults to current quarter if not supplied.

 Returns

     A three element array containing the following data:

        aDateInfo[1] - The year and qtr. as a character string "YYYYQQ"
        aDateInfo[2] - The beginning date of the accounting quarter
        aDateInfo[3] - The ending date of the accounting quarter

 Description

     FT_ACCTQTR() creates an array containing data about the
     accounting quarter containing the given date.

     An accounting period has the following characteristics:

     If the first week of the period contains 4 or more 'work'
     days, it is included in the period; otherwise, the first
     week was included in the prior period.

     If the last week of the period contains 4 or more 'work'
     days it is included in the period; otherwise, the last week
     is included in the next period.  This results in 13 week
     'quarters' and 4 or 5 week 'months'.  Every 5 or 6 years, a
     'quarter' will contain 14 weeks and the year will contain 53
     weeks.

 Examples

     // get info about accounting month containing 9/15/90
     aDateInfo := FT_ACCTQTR( CTOD("09/15/90") )
     ? aDateInfo[1]   //  199003       (3rd quarter)
     ? aDateInfo[2]   //  07/01/90     beginning of quarter 3
     ? aDateInfo[3]   //  09/29/90     end of quarter 3

     // get info about accounting qtr. 2 in year containing 9/15/90
     aDateInfo := FT_ACCTQTR( CTOD("09/15/90"), 2 )
     ? aDateInfo[1]   //  199002
     ? aDateInfo[2]   //  04/01/89   beginning of quarter 2
     ? aDateInfo[3]   //  06/30/90   end of quarter 2

 Source: ACCTQTR.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_DATECNFG() FT_ACCTWEEK() FT_ACCTMONTH() FT_ACCTYEAR()

 

FT_ACCTMONTH

FT_ACCTMONTH()
 Return accounting month data

 Syntax

      FT_ACCTMONTH( [ <dGivenDate> ], [ <nMonthNum> ] ) -> aDateInfo

 Arguments

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

     <nMonthNum> is a number from 1 to 12 signifying a month.
     Defaults to current month if not supplied.

 Returns

     A three element array containing the following data:

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

 Description

     FT_ACCTMONTH() creates an array containing data about the
     accounting month containing the given date.

     An accounting period has the following characteristics:

     If the first week of the period contains 4 or more 'work'
     days, it is included in the period; otherwise, the first
     week was included in the prior period.

     If the last week of the period contains 4 or more 'work'
     days it is included in the period; otherwise, the last week
     is included in the next period.  This results in 13 week
     'quarters' and 4 or 5 week 'months'.  Every 5 or 6 years, a
     'quarter' will contain 14 weeks and the year will contain 53
     weeks.

 Examples

     // get info about accounting month containing 9/15/90
     aDateInfo := FT_ACCTMONTH( Ctod("09/15/90") )
     ? aDateInfo[1]   //  199009       (9th month)
     ? aDateInfo[2]   //  09/02/90     beginning of month 9
     ? aDateInfo[3]   //  09/29/90     end of month 9

     // get info about accounting month 5 in year containing 9/15/90
     aDateInfo := FT_ACCTMONTH( Ctod("09/15/90"), 5 )
     ? aDateInfo[1]   //  199005
     ? aDateInfo[2]   //  04/29/89   beginning of month 5
     ? aDateInfo[3]   //  06/02/90   end of month 5

 Source: ACCTMNTH.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_DATECNFG() FT_ACCTWEEK() FT_ACCTQTR() FT_ACCTYEAR()

FT_ACCTADJ

FT_ACCTADJ()
 Adjust beginning or ending fiscal pd. dates to acctg. dates

 Syntax

      FT_ACCTADJ( [ <dGivenDate> ], [ <lIsEnd> ] ) -> dDate

 Arguments

     <dGivenDate> is any valid date in any valid format.
     Defaults to DATE() if not supplied.

     <lIsEnd> is a logical variable. .F. = adjust for beginning of
     period mode, .T. = adjust for end of period mode.  Defaults to
     beginning of period mode.

 Returns

     An adjusted date dependent upon mode and work week start day.

 Description

     Called by other FT_ACCT.. functions. The algorithm is:

     Beginning of period mode:

        If dGivenDate is in last 3 days of work week
           Return next week's start date
        Else
           Return this week's start date
        Endif

     End of period mode:

        If dGivenDate is in last 4 days of work week
           Return this week's end date
        Else
           Return prior week's end date
        Endif

 Examples

     Beginning of period mode (lIsEnd == .F.)

       dDate := Ctod( "01/31/91" )  // In last 3 days of work week
       ? FT_ACCTADJ( dDate )        // 02/03/91 (next week's start)

       dDate := Ctod( "03/31/91" )  // Not in last 3 days of work week
       ? FT_ACCTADJ( dDate )        // 03/31/91 (this week's start)

     End of period mode (lIsEnd == .T.)

       dDate := Ctod( "01/31/91" )  // In last 4 days of work week
       ? FT_ACCTADJ( dDate, .T. )   // 02/02/91 (this week's end)

       dDate := Ctod( "03/31/91" )  // Not in last 4 days of work week
       ? FT_ACCTADJ( dDate, .T. )   // 03/30/91 (prior week's end)

 Source: ACCTADJ.PRG

 Author: Jo W. French dba Practical Computing

See Also: FT_DATECNFG() FT_DAYTOBOW()