
                    RexxDate Function Package for OS/2

                              version 1.1

                    (c) Copyright Barry Pederson 1994
                          All rights Reserved.


What is RexxDate?

    RexxDate is a REXX function package for manipulating calendar dates.

Requirements

    RexxDate requires OS/2 2.0 or later.

Installation & Removal

    The RexxDate function is contained in the REXXDATE.DLL file, which
    needs to be placed in a directory that appears in your LIBPATH.
    Before the date manipulation function can be used, it must be
    registered in REXX with code such as:

        /* check whether the RxDate Function is loaded, if not, load it */
        IF RxFuncQuery('RxDate')
            THEN CALL RxFuncAdd 'RxDate', 'RexxDate', 'RxDate'

    The DLL can be unloaded by exiting all CMD.EXE shells


The Function

    --------------------------------------------------
    rc = RxDate(<date-string>, <format-specifier>)
    --------------------------------------------------

        The first parameter is either an integer containing the number of
        days since 1/1/1970. or a date string in one of these forms:

            mm-dd  mm-dd-yy  mm-dd-yyyy yyyy-mm-dd

            yy-mm-dd (only if yy > 12)

                ----------------------------------------------------
                Characters other than '-' can be used as separators
                Dates must be in the range 1/1/1970 - 12/31/2037
                ----------------------------------------------------

        If the first parameter is omitted, then the current date will be
        assumed.

        If the second parameter is omitted, than an integer is returned
        containing the number of days between the specified day and
        1/1/1970.  If the date is out of the allowed range, -1 is returned.

        Arithmetic functions can be used to manipulate the returned
        values, for example:

            today = rxDate()
            tomorrow = today + 1
            yesterday = today - 1

            days_until_new_years_eve = rxDate('12/31') - today

        If the function is called with a second parameter, then the 
        function returns the date formatted according to the second 
        parameter.  If the date is out of the allowed range, the string
        "Error converting date" is returned.

        The second parameter should contain format-specifiers as used by
        the C strftime() function.  The specifiers relating to dates are:

            %a - abbreviated weekday name (Sun)
            %A - full weekday name (Sunday)
            %b - abbreviated month name (Dec)
            %B - full month name (December)
            %d - day of the month (01-31)
            %j - day of the year (001-366)
            %m - month (01-12)
            %U - week of the year, where Sunday is the first day (00-53)
            %w - weekday (0-6) where Sunday is 0
            %W - weekday (0-6) where Monday is 0
            %x - the date formatted according to the current locale
            %y - last two digits of the year (00-99)
            %Y - the year (1970-2037)
            %% - the percent character

        Here is an example:

            say 'Today is' rxDate(, '%A %B %d, %Y')

            sunday = rxDate() - rxDate(, '%w')

            say 'The week started on:' rxDate(sunday, '%x')
            say 'And ends on:' rxDate(sunday+6, '%x')

        should print something like:

            Today is Friday October 07, 1994
            The week started on: 10/02/94
            And ends on: 10/08/94


------------------------------------------------------------------------

    That's it, just one function.  But it allows you to do quite a bit,
    especially the second form of function with its format-specifiers.

    For comments or suggestions, mail to:

        bapeders@badlands.nodak.edu

    and I'd love to hear if anyone comes up with a good use for this
    DLL.

------------------------------------------------------------------------
