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
Tag Archives: FT_DAYTOBOW()
FT_YEAR
FT_YEAR() Return calendar or fiscal year data Syntax FT_YEAR( [ <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 year aDateInfo[3] - The ending date of the year Description FT_YEAR() returns an array containing data about the year containing the given date. Normally the return data will be based on a year beginning on January 1st. The beginning of year date can be changed by using FT_DATECNFG(), which will affect all subsequent calls to FT_YEAR() until another call to FT_DATECNFG(). The beginning of year date may be reset to January 1 by calling FT_DATECNFG() with no parameters. Examples // Get info about year containing 9/15/90, assuming default // beginning of year is January 1st. aDateInfo := FT_YEAR( Ctod("09/15/90") ) ? aDateInfo[1] // 1990 ? aDateInfo[2] // 01/01/90 beginning of year ? aDateInfo[3] // 12/31/90 end of year // get info about current year (1991). aDateInfo := FT_YEAR() ? aDateInfo[1] // 1991 ? aDateInfo[2] // 01/01/91 beginning of year ? aDateInfo[3] // 12/31/91 end of year Source: YEAR.PRG Author: Jo W. French dba Practical Computing
See Also: FT_DATECNFG() FT_WEEK() FT_MONTH() FT_QTR()
FT_WOY
FT_WOY() Find number of week within year Syntax FT_WOY( <dDate> ) -> <nResult> Arguments <dDate> is a date in the form "mm/dd/yy" or "mm/dd/yyyy" Returns Return numeric position of week within the year or NIL if parameter does not conform. Description Considers a full week as starting on Sunday, ending on Saturday. First week of year (week 1) may start on any day, and thus contain any number of days. Final week of year (week 53) may contain any number of days. Handles dates with CENTURY ON|OFF, to allow for 21st century. Date validation must be external to this function. Examples These code fragments find the week number, given a date. // literal character date dDate := CTOD("01/01/91") nWkNum := FT_WOY(dDate) // result: 1 // presume DOS date to be 01/06/91 nWkNum := FT_WOY(DATE()) // result: 2 // date input cDate := SPACE(8) @ 4,10 get cDate PICT "##/##/##" // input 07/04/91 READ nWkNum := FT_WOY(CTOD(cDate)) // result: 27 // last day of year nWkNum := FT_WOY(CTOD("12/31/91")) // result: 53 For a demonstration of this function, compile and link the program WOY.PRG in the Nanforum Toolkit source code. Source: WOY.PRG Author: Forest Belt, Computer Diagnostic Services, Inc.
FT_WORKDAYS
FT_WORKDAYS() Return number of work days between two dates Syntax FT_WORKDAYS( [ <dStart> ], [ <dStop> ] ) -> nDays Arguments <dStart> is the beginning value for the date range. <dStop> is the ending value for the date range. Returns The number of work days (Monday through Friday) between two dates. Description FT_WORKDAYS() returns a number indicating the number of work days between two dates. Work days are considered Monday through Friday. (The five day work week none of us Clipper programmers have.) Examples ? FT_WorkDays( CTOD("5/16/91"), CTOD("5/20/91") ) // 3 (Th - Mo) ? FT_WorkDays( CTOD("5/18/91"), CTOD("5/19/91") ) // 0 (Sa - Su) ? FT_WorkDays( CTOD("5/17/91"), CTOD("5/17/91") ) // 1 (Fr - Fr) Source: WORKDAYS.PRG Author: John F. Kaster
FT_WEEK
FT_WEEK() Return calendar or fiscal week data Syntax FT_WEEK( [ <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 53 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 week aDateInfo[3] - The ending date of the week Description FT_WEEK() returns an array containing data about the week containing the given date. Normally the return data will be based on a year beginning on January 1st with weeks beginning on Sunday. The beginning of year date and/or beginning of week day can be changed by using FT_DATECNFG(), which will affect all subsequent calls to FT_WEEK() until another call to FT_DATECNFG(). The beginning of year date and beginning of week day may be reset to January 1 and Sunday by calling FT_DATECNFG() with no parameters. Examples // get info about week containing 9/15/90 aDateInfo := FT_WEEK( 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 week 25 in year containing 9/15/90 aDateInfo := FT_WEEK( CTOD("09/15/90"), 25 ) ? aDateInfo[1] // 199025 ? aDateInfo[2] // 06/17/90 beginning of week 25 ? aDateInfo[3] // 06/23/90 end of week 25 // get info about week 25 in current year( 1991 ) aDateInfo := FT_WEEK( , 25 ) ? aDateInfo[1] // 199025 ? aDateInfo[2] // 06/16/91 beginning of week 25 ? aDateInfo[3] // 06/22/91 end of week 25 Source: WEEK.PRG Author: Jo W. French dba Practical Computing
See Also: FT_DATECNFG() FT_MONTH() FT_QTR() FT_YEAR() FT_DAYTOBOW()
FT_MADD
FT_MADD() Add or subtract months to/from a date Syntax FT_MADD( [ <dGivenDate> ], [ <nAddMonths> ], [ <lMakeEOM> ] ) -> dDate Arguments <dGivenDate> is any valid date in any date format. Defaults to current system date if not supplied. <nAddMonths> is the number of months to be added or subtracted. Defaults to 0 if not supplied. <lMakeEOM> is a logical variable indicating whether or not to force the returned date to the last date of the month. It only affects the returned date if <dGivenDate> is an end-of-month date. Returns A date. Description FT_MADD() adds or subtracts months to/from a given date. If MakeEOM is passed and dGivenDate is the last day of a month, it will return the EOM of calculated month. Otherwise it will return the same day as the day of the passed date. Examples dDate := CTOD( "09/15/90" ) ? FT_MADD( dDate, 1 ) // 10/15/90 ? FT_MADD( dDate, -2 ) // 07/15/90 // force EOM dDate := CTOD( "04/30/91" ) ? FT_MADD( dDate, 1 ) // 05/30/91 ? FT_MADD( dDate, 1, .T. ) // 05/31/91 <- forced EOM ? FT_MADD( dDate, 2 ) // 06/30/91 ? FT_MADD( dDate, 2, .T. ) // 06/30/91 <- June only has 30 days ? FT_MADD( dDate, 3 ) // 07/30/91 ? FT_MADD( dDate, 3, .T. ) // 07/31/91 <- forced EOM Source: MADD.PRG Author: Jo W. French dba Practical Computing
See Also: FT_DAYOFYR() FT_DAYTOBOW()
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_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()