home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxdate.zip
/
RexxDate.INF
(
.txt
)
< prev
next >
Wrap
OS/2 Help File
|
1994-03-10
|
4KB
|
113 lines
ΓòÉΓòÉΓòÉ 1. Introduction ΓòÉΓòÉΓòÉ
RexxDate is a group of functions for Rexx that allow manipulation of dates. The
following functions are available:
Function Purpose
RexxDate_Init Registers the RexxDate functions.
RexxDate_Diff Returns the difference in days between two dates.
RexxDate_Drop Deregisters the RexxDate functions. This drops ALL
the functions.
RexxDate_Isleap Returns 1 if the year is a leap year, otherwise 0.
ΓòÉΓòÉΓòÉ 2. Using RexxDate Functions ΓòÉΓòÉΓòÉ
The RexxDate functions are used by calling them in REXX statements.
ΓòÉΓòÉΓòÉ 2.1. Registering RexxDate Functions ΓòÉΓòÉΓòÉ
The RexxDate functions must be registered before they can be used. This is
done by calling RexxDate_Init which registers all the functions for use.
ΓòÉΓòÉΓòÉ 2.2. Unregistering (dropping) RexxDate Functions ΓòÉΓòÉΓòÉ
The RexxDate functions can be unregistered (dropped) if they are no longer
needed. This is done by calling RexxDate_Drop.
ΓòÉΓòÉΓòÉ 3. The RexxDate Functions ΓòÉΓòÉΓòÉ
The RexxDate functions are:
Function Purpose
RexxDate_Init Registers the RexxDate functions.
RexxDate_Diff Returns the difference in days between two dates.
RexxDate_Drop Deregisters the RexxDate functions. This drops ALL
the functions.
RexxDate_Isleap Returns 1 if the year is a leap year, otherwise 0.
ΓòÉΓòÉΓòÉ 3.1. RexxDate_Init - Register functions. ΓòÉΓòÉΓòÉ
RexxDate_init registers the RexxDate functions for use by REXX.
if RxFuncQuery('RexxDate_Init')
then
do
retcode = RxFuncAdd(RexxDate_Init, 'REXXDATE', 'RexxDate_Init')
retcode = RexxDate_Init()
Wasregistered = 0
end /* end do */
else
Wasregisterd = 1
It is good practice to determine whether or not the function is already
registered. If it is you do not want to drop it as that will prevent the other
users from accessing it.
ΓòÉΓòÉΓòÉ 3.2. RexxDate_Diff - Difference in days ΓòÉΓòÉΓòÉ
RexxDate_Diff returns the difference in days between two dates. It can be
called with one or two arguments:
RexxDate_Diff(date1, date2) Returns the difference between date1 and
date2 (date1 - date2) in days.
RexxDate_Diff( , date2) Returns the difference between the current
date and date2 (now - date2) in days.
RexxDate_Diff(date1) Returns the difference between date1 and
the current date (date1 - now) in days.
The date must be in the format MM/DD/YY i.e. 2/4/49, 1/32/92.
date1 = '2/28/94'
date2 = '2/18/94'
diff = RexxDate_Diff(date1,date2)
say 'Difference in days between' date1 'and' date2 'is' diff
This returns:
Difference in days between 2/28/94 and 2/18/94 is 10
ΓòÉΓòÉΓòÉ 3.3. RexxDate_Drop - Drop RexxDate functions ΓòÉΓòÉΓòÉ
RexxDate_Drop is used to unregister (drop) the RexxDate functions.
if (\WasRegistered)
then
retcode = RexxDate_Drop()
ΓòÉΓòÉΓòÉ 3.4. RexxDate_Isleap - Leap year check ΓòÉΓòÉΓòÉ
RexxDate_Isleap returns 1 if the year is a leap year, otherwise 0. Any year
that is returns no remainder when divided by four AND returns a remainder when
divide by 100 OR has no remainder when divided by 400 is assumed to be a leap
year.
parse value DATE('U') with mon'/'day'/'yr
Do year = 1900 + yr to 2010
say year RexxDate_Isleap(year)
end /* do */
The years 96, 2000, 2008 should return a 1, the rest will return 0.
The year must be in YYYY format (all four digits must be specified).