DATE/TIME

Name

DATE/TIME -- 

Function

TRUE || FALSE       BETWEEN(<TargetData>, <FirstData>, <SecondData>)
cDayName            CDOW(<dExp>)
cMonth              CMONTH(<dDate>)
dDate               CTOD(<cDate>)
dSystem             DATE()
nDay                DAY(<dDate>)
nDay                DOW(<dDate>)
cDate               DTOC(<dDate>)
cDate               DTOS(<dDate>)
lEmpty              EMPTY(<exp>)
dDate               FT_ACCTADJ( [ <dGivenDate> ], [ <lIsEnd> ] )
aDateInfo           FT_ACCTMONTH( [ <dGivenDate> ], [ <nMonthNum> ] )
aDateinfo           FT_ACCTQTR( [ <dGivenDate> ], [ <nQtrNum> ] )
aDateInfo           FT_ACCTWEEK( [ <dGivenDate> ], [ <nWeekNum> ] )
aDateInfo           FT_ACCTYEAR( [ <dGivenDate> ] )
nTrueDays           FT_ADDWKDY( <dStart>, <nWorkDays> )
aRetVal             FT_CALENDAR ( [ <nRow> ], [ <nCol> ], [ <cColor> ], [ <lShadow> ] , [ <lShowHelp> ] )
cMILTIME            FT_CIV2MIL( <cCIVTIME> )
aDateInfo           FT_DATECNFG( [ <cFYStart> ], [ <nDow> ] )
aDateInfo           FT_DAYOFYR( [ <dGivenDate> ], [ <nDayNum> ], [ <lIsAcct> ] )
nDays               FT_DAYTOBOW( [ <dGivenDate> ] )
<nResult>           FT_DOY( <dDate> )
dEdate              FT_EASTER( <xYear> )
nMINUTES            FT_ELAPMIN( <cTIME1>, <cTIME2> )
aTimedata           FT_ELAPSED([ <dStart> ], [ <dEnd> ], ; <cTimeStart>, <cTimeEnd>)
cDiff               FT_ELTIME( <cTime1>, <cTime2> )
dFirstDay           FT_FDAY( [ <dDateToChk> ] )
dLastDay            FT_LDAY( [ <dDateToChk> ] )
dDate               FT_MADD( [ <dGivenDate> ], [ <nAddMonths> ], [ <lMakeEOM> ] )
dMILTIME            FT_MIL2CIV( <cCIVTIME> )
nMINUTE             FT_MIL2MIN( <cMILTIME> )
aDHM_               FT_MIN2DHM( <nMinutes> )
cMILTIME            FT_MIN2MIL( <nMINUTE> )
aDateInfo           FT_MONTH( [ <dGivenDate> ], [nMonthNum] )
aDateInfo           FT_QTR( [ <dGivenDate> ], [ <nQtrNum> ] )
cMILTIME            FT_SYS2MIL()
aDateinfo           FT_WEEK( [ <dGivenDate> ], [ <nWeekNum> ] )
nDays               FT_WORKDAYS( [ <dStart> ], [ <dStop> ] )
<nResult>           FT_WOY( <dDate> )
aDateInfo           FT_YEAR( [ <dGivenDate> ] )
dLarger             MAX(<nExp1>, <nExp2>) --> nLarger MAX(<dExp1>, <dExp2>)
dSmaller            MIN(<nExp1>, <nExp2>) --> nSmaller MIN(<dExp1>, <dExp2>)
nMonth              MONTH(<dDate>)
NIL                 QOUT([<exp list>]) --> NIL QQOUT([<exp list>])
nSeconds            SECONDS()
NIL                 SLEEP(<nSec>)
cTimeString         TIME()
cFormatString       TRANSFORM(<exp>, <cSayPicture>)
cType               TYPE(<cExp>)
cType               VALTYPE(<exp>)
nYear               YEAR(<dDate>)

Description

Function CDOW()

 CDOW(<dExp>) --> cDayName

CDOW() is a date conversion function used in formatting date displays for reports, labels, and screens.

Function CMONTH()

 CMONTH(<dDate>) --> cMonth

CMONTH() is a date conversion function useful for creating formatted date strings that can be used in reports, labels, or screens.

Function CTOD()

 CTOD(<cDate>) --> dDate

CTOD() is a character conversion function that converts a character string to a date. To initialize an empty date for date entry, specify <cDate> as a null string (""), SPACE(8), or " / / ".

CTOD() is used whenever you need a literal date value. Some examples are:

Initializing a variable to a date value

Specifying a literal date string as an argument of a RANGE clause of @...GET

Specifying a literal date string in order to perform date arithmetic

Comparing the result of a date expression to a literal date string

REPLACEing a date field with a literal date string

CTOD() is the inverse of DTOC() which converts a date value to a character string in the format specified by SET DATE and SET CENTURY. DTOS() also converts a date value to a character string in the form yyyymmdd.

Function DATE()

 DATE() --> dSystem

DATE() is a date function that provides a means of initializing memory variables to the current date, comparing other date values to the current date, and performing date arithmetic relative to the current date.

The display format for dates is controlled by the SET DATE command. The default format is mm/dd/yy.

Function DAY()

 DAY(<dDate>) --> nDay

DAY() is a date conversion function used to convert a date value to the day of a month. This function is used in combination with CMONTH() and YEAR() to format dates. In addition, it is often used in various date calculations.

Function DOW()

 DOW(<dDate>) --> nDay

DOW() is a date conversion function that converts a date value to a number identifying the day of the week. It is useful when you want date calculations on a weekly basis. DOW() is similar to CDOW(), which returns the day of week as a character string instead of a number.

Function DTOC()

 DTOC(<dDate>) --> cDate

DTOC() is a date conversion function used for formatting purposes when you want to display the date in the SET DATE format and when a character expression is required (in a LABEL FORM, for example). If you need a specialized date format, you can use TRANSFORM() or a custom expression.

If you are INDEXing a date in combination with a character string, use DTOS() instead of DTOC() to convert the date value to a character string.

Function DTOS()

 DTOS(<dDate>) --> cDate

DTOS() is a date conversion function that is used when creating index expressions consisting of a date value and a character expression. DTOS() converts a date value to a character string that can be concatenated to any other character expression. The return value is structured to preserve date order (year, month, and day).

Function FT_ACCTADJ()

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

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

Function FT_ACCTMONTH()

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

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.

Function FT_ACCTQTR()

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

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.

Function FT_ACCTWEEK()

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

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.

Function FT_ACCTYEAR()

 FT_ACCTYEAR( [ <dGivenDate> ] ) --> aDateInfo

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.

Function FT_ADDWKDY()

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

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.

Function FT_CALENDAR()

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

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!

Function FT_CIV2MIL()

 FT_CIV2MIL( <cCIVTIME> ) --> cMILTIME

Converts time from 12-hour civilian format to military.

Function FT_DATECNFG()

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

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

Function FT_DAYOFYR()

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

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

Function FT_DAYTOBOW()

 FT_DAYTOBOW( [ <dGivenDate> ] ) --> nDays

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

Function FT_DOY()

 FT_DOY( <dDate> ) --> <nResult>

Finds the day number, considering 01/01 as day 1 Handles dates with CENTURY ON|OFF, to allow for 21st century. Date validation must be external to this function.

Function FT_EASTER()

 FT_EASTER( <xYear> ) --> dEdate

Returns the date of Easter for any year after 1582 up to Clipper's limit which the manual states is 9999, but the Guide agrees with the actual imposed limit of 2999.

This function can be useful in calender type programs that indicate when holidays occur.

Function FT_ELAPMIN()

 FT_ELAPMIN( <cTIME1>, <cTIME2> ) --> nMINUTES

Finds the arithmetic difference between time two times (time 2 - time 1). If time 2 is smaller than time 1, a NEGATIVE value is returned.

Function FT_ELAPSED()

 FT_ELAPSED([ <dStart> ], [ <dEnd> ], ;
 <cTimeStart>, <cTimeEnd>) --> aTimedata

FT_ELAPSED() calculates the elapsed time between two Date/Time events.

It returns an array which contains the following data:

aRetVal[1,1] Integer Days aRetVal[1,2] Total Days (nn.nnnn) aRetVal[2,1] Integer Hours aRetVal[2,2] Total Hours (nn.nnnn) aRetVal[3,1] Integer Minutes aRetVal[3,2] Total Minutes (nn.nnnn) aRetVal[4,1] Integer Seconds aRetVal[4,2] Total Seconds (nn)

Function FT_ELTIME()

 FT_ELTIME( <cTime1>, <cTime2> ) --> cDiff

Return the absolute difference between two times in hh:mm:ss format in character hours, minutes and seconds (hh:mm:ss).

Function FT_FDAY()

 FT_FDAY( [ <dDateToChk> ] ) --> dFirstDay

This function will return the first day of the month of the date passed, or the first day of the current month if no argument is supplied.

Function FT_LDAY()

 FT_LDAY( [ <dDateToChk> ] ) --> dLastDay

This function will return the last day of the month of the date passed, or the last day of the current month if no argument is supplied.

Function FT_MADD()

 FT_MADD( [ <dGivenDate> ], [ <nAddMonths> ], [ <lMakeEOM> ] )
 --> dDate

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.

Function FT_MIL2CIV()

 FT_MIL2CIV( <cCIVTIME> ) --> dMILTIME

Converts time from military to civilian format

Function FT_MIL2MIN()

 FT_MIL2MIN( <cMILTIME> ) --> nMINUTE

Converts time in military format to number of minute of the day.

Function FT_MIN2DHM()

 FT_MIN2DHM( <nMinutes> ) --> aDHM_

Converts numeric minutes into a character array containing days, hours & minutes.

Function FT_MIN2MIL()

 FT_MIN2MIL( <nMINUTE> ) --> cMILTIME

Converts minute of the day to military format time.

Function FT_MONTH()

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

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.

Function FT_QTR()

 FT_QTR( [ <dGivenDate> ], [ <nQtrNum> ] ) --> aDateInfo

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.

Function FT_SYS2MIL()

 FT_SYS2MIL() --> cMILTIME

Return current system time as character string in military format.

Function FT_WEEK()

 FT_WEEK( [ <dGivenDate> ], [ <nWeekNum> ] ) --> aDateinfo

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.

Function FT_WORKDAYS()

 FT_WORKDAYS( [ <dStart> ], [ <dStop> ] ) --> nDays

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

Function FT_WOY()

 FT_WOY( <dDate> ) --> <nResult>

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.

Function FT_YEAR()

 FT_YEAR( [ <dGivenDate> ] ) --> aDateInfo

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.

Function MONTH()

 MONTH(<dDate>) --> nMonth

MONTH() is a date conversion function that is useful when you require a numeric month value during calculations for such things as periodic reports. MONTH() is a member of a group of functions that return components of a date value as numeric values. The group includes DAY() and YEAR() to return the day and year values as numerics. CMONTH() is a related function that allows you to return the name of the month from a date value.

Function SECONDS()

 SECONDS() --> nSeconds

SECONDS() is a time function that provides a simple method of calculating elapsed time during program execution, based on the system clock. It is related to the TIME() function which returns the system time as a string in the form hh:mm:ss.

Function TIME()

 TIME() --> cTimeString

TIME() is a time function that displays the system time on the screen or prints it on a report. TIME() is related to SECONDS() which returns the integer value representing the number of seconds since midnight. SECONDS() is generally used in place of TIME() for time calculations.

Function YEAR()

 YEAR(<dDate>) --> nYear

YEAR() is a date conversion function that converts a date value to a numeric year value. Use it in calculations for things like periodic reports or for formatting date displays.

YEAR() is a member of a group of functions that return components of a date value as numeric values. The group includes DAY() and MONTH() which return the day and month values as numeric values.