home *** CD-ROM | disk | FTP | other *** search
- /*********
- *
- * EOQTR.C
- *
- * by Tom Rettig
- *
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: EOQTR( <expD> )
- * Return: <expD> date of last day of <date>'s calendar quarter
- *********/
-
- #include "trlib.h"
-
- TRTYPE eoqtr()
- {
- int month;
- int day;
- char *ds;
-
- if ( PCOUNT == 1 && ISDATE(1) )
- {
- ds = _pards(1);
- month = DSMONTH(ds); /* Extract month from date string */
- month = (((month + 2) / 3) * 3); /* Convert month to 3, 6, 9, or 12 */
- day = _tr_ldm(month, DSYEAR(ds)); /* day is last day of new month */
-
- ds[4] = (month / 10) + '0'; /* Break up digits and convert to ASCII */
- ds[5] = (month % 10) + '0';
- ds[6] = (day / 10) + '0'; /* Likewise with day */
- ds[7] = (day % 10) + '0';
-
- _retds( ds);
- }
- else
- _retds( BLANKDS );
- }
-
-
-