FT Date-Time

 FT_ACCTADJ()     Adjust beginning or ending fiscal pd. dates to acctg. dates
 FT_ACCTMONTH()   Return accounting month data
 FT_ACCTQTR()     Return accounting quarter data
 FT_ACCTWEEK()    Return accounting week data
 FT_ACCTYEAR()    Return accounting year data
 FT_ADDWKDY()     Return true number of days to add given number of workdays
 FT_CALENDAR()    Display date/time calendar, find a date, return calendar data.
 FT_CIV2MIL()     Convert usual civilian format time to military time.
 FT_DATECNFG()    Set beginning of year/week for FT_ date functions
 FT_DAYOFYR()     Return calendar, fiscal or accounting day data
 FT_DAYTOBOW()    Calculate no. of days between date and beginning of week
 FT_DOY()         Find number of day within year
 FT_EASTER()      Return the date of Easter
 FT_ELAPMIN()     Return difference, in minutes, between two mil format times.
 FT_ELAPSED()     Return elapsed time between two days and/or times
 FT_ELTIME()      Compute difference between times in hours, minutes, seconds.
 FT_FDAY()        Return first day of the month
 FT_LDAY()        Return last day of the month
 FT_MADD()        Add or subtract months to/from a date
 FT_MIL2CIV()     Convert time in military format to civilian format.
 FT_MIL2MIN()     Convert time in military format to number of minute of day.
 FT_MIN2DHM()     Convert numeric minutes to days, hours and minutes.
 FT_MIN2MIL()     Convert minute of day to military format time.
 FT_MONTH()       Return Calendar or Fiscal Month Data
 FT_QTR()         Return Calendar or Fiscal Quarter Data.
 FT_SYS2MIL()     Convert system time to military time format.
 FT_WEEK()        Return calendar or fiscal week data
 FT_WORKDAYS()    Return number of work days between two dates
 FT_WOY()         Find number of week within year
 FT_YEAR()        Return calendar or fiscal year data

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


 

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