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 Date-Time
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_SYS2MIL
FT_SYS2MIL()
Convert system time to military time format.
Syntax
FT_SYS2MIL() -> cMILTIME
Arguments
none
Returns
<cMILTIME> character string of form hhmm, where 0<=hh<24.
Description
Return current system time as character string in military format.
Examples
FT_SYS2MIL() -> 1623
Source: MILTIME.PRG
Author: Alexander B. Spencer
See Also: FT_MIL2CIV() FT_CIV2MIL()
FT_QTR
FT_QTR()
Return Calendar or Fiscal Quarter Data.
Syntax
FT_QTR( [ <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 quarter as a character string "YYYYQQ"
aDateInfo[2] - The beginning date of the quarter
aDateInfo[3] - The ending date of the quarter
Description
FT_QTR() returns an array containing data about the quarter
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_QTR() 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 quarter containing 9/15/90
aDateInfo := FT_QTR( CTOD("09/15/90") )
? aDateInfo[1] // 199003 (3rd quarter)
? aDateInfo[2] // 07/01/90 beginning of quarter 3
? aDateInfo[3] // 09/30/90 end of week quarter 3
// get info about quarter 2 in year containing 9/15/90
aDateInfo := FT_QTR( CTOD("09/15/90"), 2 )
? aDateInfo[1] // 199002
? aDateInfo[2] // 04/01/90 beginning of quarter 2
? aDateInfo[3] // 06/30/90 end of quarter 2
// get info about quarter 2 in current year (1991)
aDateInfo := FT_QTR( , 2 )
? aDateInfo[1] // 199102
? aDateInfo[2] // 04/01/91 beginning of quarter 2
? aDateInfo[3] // 06/30/91 end of quarter 2
Source: QTR.PRG
Author: Jo W. French dba Practical Computing
See Also: FT_DATECNFG() FT_WEEK() FT_MONTH() FT_YEAR()
FT_MONTH
FT_MONTH()
Return Calendar or Fiscal Month Data
Syntax
FT_MONTH( [ <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 month
aDateInfo[3] - The ending date of the month
Description
FT_MONTH() returns an array containing data about the month
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_MONTH() 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 month containing 9/15/90
aDateInfo := FT_MONTH( CTOD("09/15/90") )
? aDateInfo[1] // 199009 (9th month)
? aDateInfo[2] // 09/01/90 beginning of month 9
? aDateInfo[3] // 09/30/90 end of week month 9
// get info about month 5 in year containing 9/15/90
aDateInfo := FT_MONTH( CTOD("09/15/90"), 5 )
? aDateInfo[1] // 199005
? aDateInfo[2] // 05/01/90 beginning of month 5
? aDateInfo[3] // 05/31/90 end of month 5
// get info about month 5 in current year (1991)
aDateInfo := FT_MONTH( , 5 )
? aDateInfo[1] // 199105
? aDateInfo[2] // 05/01/91 beginning of month 5
? aDateInfo[3] // 05/31/91 end of month 5
Source: MONTH.PRG
Author: Jo W. French dba Practical Computing
See Also: FT_DATECNFG() FT_WEEK() FT_QTR() FT_YEAR()
FT_MIN2MIL
()
Convert minute of day to military format time.
Syntax
FT_MIN2MIL( <nMINUTE> ) -> cMILTIME
Arguments
<nMINUTE> numeric integer representing minute of day.
Returns
<cMILTIME> character string of form hhmm, where 0<=hh<24.
Description
Converts minute of the day to military format time.
Examples
FT_MIN2MIL( 279 ) -> 0439
Source: MILTIME.PRG
Author: Alexander B. Spencer
See Also: FT_MIL2MIN() FT_MIL2CIV() FT_CIV2MIL() FT_SYS2MIL()
FT_MIN2DHM
FT_MIN2DHM()
Convert numeric minutes to days, hours and minutes.
Syntax
FT_MIN2DHM( <nMinutes> ) -> aDHM_
Arguments
<nMinutes> the number of minutes.
Returns
<aDHM_>
where:
aDHM_[1] = cDAYS, aDHM_[2] = cHours, aDHM_[3] = cMinutes
Description
Converts numeric minutes into a character array containing
days, hours & minutes.
Examples
aDHM_ = MIN2DHM(16789) -> aDHM_[1] = 11, aDHM_[2] = 15, aDHM_[3] = 49
Source: MIN2DHM.PRG
Author: Alexander B. Spencer
FT_MIL2MIN
FT_MIL2MIN()
Convert time in military format to number of minute of day.
Syntax
FT_MIL2MIN( <cMILTIME> ) -> nMINUTE
Arguments
<cMILTIME> character string of form hhmm, where 0<=hh<24.
Returns
<nMINOFDAY> numeric value representing minute of day.
Description
Converts time in military format to number of minute of the day.
Examples
FT_MIL2MIN( "1729" ) -> 1049
Source: MILTIME.PRG
Author: Alexander B. Spencer
See Also: FT_MIN2MIL() FT_CIV2MIL() FT_MIL2CIV() FT_SYS2MIL()