home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
rettig
/
source
/
boqtr.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-21
|
847b
|
39 lines
/*********
*
* BOQTR.C
*
* by Tom Rettig
*
* Placed in the public domain by Tom Rettig Associates, 10/22/1990.
*
* Syntax: BOQTR( <expD> )
* Return: <expD> date of first day of <date>'s calendar quarter
*********/
#include "trlib.h"
TRTYPE boqtr()
{
int month;
char *ds;
if ( PCOUNT == 1 && ISDATE(1) )
{
ds = _pards(1);
month = DSMONTH(ds); /* Extract month from date string */
month = (((month - 1) / 3) * 3) + 1; /* Takes month down
to nearest multiple of 3, +1 */
ds[4] = (month / 10) + '0'; /* Convert to ASCII */
ds[5] = (month % 10) + '0';
ds[6] = '0'; /* Quarter always begins on the 1st */
ds[7] = '1';
_retds( ds);
}
else
_retds( BLANKDS );
}