In this section, we present an overview of the functions that can
specified on the /F (function) parameter.
Fdate's most important parameter is the function parameter, /F. Here is
a brief summary of the functions that may be specified on the /F parm,
for example: /Fadd. Detailed descriptions of each of the functions can
be found in other sections of this documentation.
If the /F parameter is omitted, it defaults to the null string, which
causes Fdate to display its HELP screens.
The general format of an Fdate statement is:
with a variety of parameters following the /F.
For example:
- Fdate /Ff
- Fdate /Fadd /A5 /B6 [adds 5 and 6]
- Fdate /Flen /Q"this is a test" [produces the length of "this is a test"]
GENERAL DATE FUNCTIONS
- F
Format the date in the /A parm into format specified in /O parm
- ADD
Add the number of days in the /N parm to the date in the /A parm
- SUB
Subtract the number of days in the /N parm from the date in the /A parm
- DIF
Return the number of days between dates in the /A and /B parms
- W
Do date arithmetic in terms of weeks rather than days. Using
the date in the /A parm, a number specified in the /N parm, and
a day-of-the-week number specified in the /D parm, return the
date of the /Nth /Day-of-the-week before (or after) /Adate.
- M
Do date arithmetic in terms of months rather than days. Add the
number of months in the /N parm to the date in the /A parm. /N
may be a negative number.
STRING-HANDLING FUNCTIONS
- GET
get user input from the keyboard, and produce it as output.
Optionally, display a prompt string.
- GETU
same as get, but produce output converted to upper case
- GETK
get a keypress and produce it (converted to upper case)
- LEN
produce the length of a string in the Q parm
- UPPER
convert the string in the Q parm to upper case
- E
Echo the strings on the P and S parameters.
- SUBSTR
Extract a substring from the Q parm, starting in column specified
on A parm, for a length specified on B parm.
DATE/TIME COMPARISON FUNCTIONS
- COMP
Compare the dates in the /A and /B parms. Return LT, EQ, or GT.
- TCOMP
Compare the times specified on the /A and /B parms.
MATH FUNCTIONS
Note that these are NOT date math functions; they are NUMBER math functions.
Functions whose names begin with "#" do ordinary arithmetic, i.e.
arithmetic on numbers rather than dates.
- #ADD
Add the integers specified on the /A and /B parms. To do
subtraction, add a negative number to a positive number.
- #DIF
returns the difference between the integers specified on the /A
and /B parms.
- #COMP
Compare the integers specified on the /A and /B parms. Return
LT, EQ, or GT.
- #MOD
Modulus. Divide the integer on the /A parm by the integer on
the /B parm, and return the remainder.
- #RANDOM
Returns a random number between a lowerbound (specified on the /B
parm) and an upperbound (specified on the /A parm).
- #MULT
Multiply the integer on the /A parm by the integer on the /B
parm, and return the result.
- #DIV
Divide the integer on the /A parm by the integer on the /B
parm, and return the result as a decimal number with two
decimal places.
- #IDIV
Integer division. Divide the integer on the /A parm by the
integer on the /B parm, and return the result as an integer.
- #2XX
Convert an integer in the range of 0-35 to "extended hex" (XX)
notation.
Note that all of Fdate's arithmetic functions operate on integers. A decimal
number on an input parameter will be rejected, and an error message will be
displayed.
- #ADD
returns the sum of the integers specified
on the /A and /B parms. Can be used to calculate the
"absolute" minute(second, date) in the future from a given
"absolute" minute(second, date). Also useful in generating
sequences of numbers and looping (see EXAMPLES).
- #SUB (NOT SUPPORTED)
Fdate does not provide a numeric subtraction operation as such.
To do subtraction, add two numbers, one of which is a negative
number. For example, to subtract 3 from 2:
Fdate /F#add /A2 /B-3 [ returns: -1 ]
- #DIF
returns the difference between the integers specified on the /A
and /B parms. #dif is the same as subtraction in which the
smaller number is subtracted from the larger number; it will
never return a negative number. It can be used to calculate the
number of minutes(seconds, days) between two "Absolute"
minutes(seconds, dates).
- #COMP
compares the integers specified on the /A and /B parms.
- returns LT /A is less than /B
- returns EQ /A is equal to /B
- returns GT /A is greater than /B
In addition, the errorlevel is set to a special value:
- LT = 101
- EQ = 102
- GT = 103
- #MOD
divides the integer on the /A parm by the integer on the /B parm,
and returns the remainder.
This is useful for determining whether a number is evenly
divisible by some other number. If the remainder is 0, then /A
is evenly divisible by /B. If a year is evenly divisible by 4,
for example, then it is an American election year. If it is
evenly divisible by 100, then it is a century year, etc.
- #MULT
multiplies the integer on the /A parm by the integer on the /B
parm, and returns the result.
- #DIV
(division) divides the integer on the /A parm by the integer on
the /B parm, and returns the result as a decimal number, with two
digits to the right of the decimal.
This is useful for dividing a number (representing the number of
minutes in some period) by 60 to get the length of the period
expressed in terms of hours, or by 1440 to get the length of the
period expressed in terms of days. Or you could divide a number
of days by 7 to get the number of weeks, etc.
- #IDIV
(integer division) divides the integer on the /A parm by the
integer on the /B parm, and returns the result as an integer.
This is useful, especially in conjunction with the #mod function,
for converting a number of minutes into a number of hours and
minutes, or days and hours and minutes. See the EXAMPLES file.
- #2XX
Convert number to "extended hex" format.