This is an inbuilt function function provided by PPWIZARD.
This function can be called to work out a basedate (julian day) given a date. The integer will be negative if an error occurred. You can tell how many days apart 2 dates are by subtraction of one from the other. The basedate is the number of days since 1 January 0001.
If the returned basedate integer is divided by 7, the remainder will tell you what day of the week it is (where 0=Monday, 6=Sunday).
The number returned for a date is compatible with rexx's "date('BaseDate')" call.
You can convert a basedate back into a displayable date with BD2DATE().
You can use GetFileTimeStamp() to obtain the date/time a file was modified and calculate a basedate from this if you wish to calculate the age of a file.
The routine takes a single parameter (the date) with the year, month and day of month being supplied in that order. The year should either be supplied as 4 digits or will pivot at 1980.
It will take the input in these formats:
Note that for most formats it actually does not matter how many digits are supplied for day of month and month, however a resonable amount of validation occurs.
|EXAMPLE INPUT DATES|
The following code could be used in a web page which has an expiry (use by) date for some reason (maybe it counts down the days to an event):
#if basedate() > basedate('20011225') #error ^This page expired 25 Dec 2001^ #endif
This code works out the date a week from now and generates it in 2 formats:
#DefineRexx '' ;--- Get date in default format for 7 days from now --- BaseDateToday = basedate(); BaseDateIn7Days = BaseDateToday + 7; DateYYYYMMDD = Bd2Date(BaseDateIn7Days); ;--- Convert to nicer format --------- parse var DateYYYYMMDD YYYY 5 MM 7 DD MmText = word('Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec', MM); DatePretty = DD+0 || ' ' || MmText || ' ' || YYYY; #DefineRexx Date in 7 Days ~~~~~~~~~~~~~~ DEFAULT: <??DateYYYYMMDD> ;;Maybe "20010403" PRETTY : <??DatePretty> ;;Maybe "3 Apr 2001"