home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
IS.ZIP
/
DATE_CMP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-10-26
|
923b
|
46 lines
/*
** date_cmp - compare two dates of the form mm/dd/yy or mm-dd-yy
** return same as strcmp:
*/
#include <string.h>
int date_cmp(char *str1, char *str2)
{
int ret;
char date1[7], date2[7];
/*
** convert str's date format from mm/dd/yy to date's format of yymmdd
**
** date from mm/dd/yy to yymmdd
** 01 34 67
**
** ex from 09-20-88 to 880920
*/
date1[0] = str1[6]; /* y */
date2[0] = str2[6];
date1[1] = str1[7]; /* y */
date2[1] = str2[7];
date1[2] = str1[0]; /* m */
date2[2] = str2[0];
date1[3] = str1[1]; /* m */
date2[3] = str2[1];
date1[4] = str1[3]; /* d */
date2[4] = str2[3];
date1[5] = str1[4]; /* d */
date2[5] = str2[4];
date1[6] = '\0'; /* end */
date2[6] = '\0';
ret = strcmp(date1, date2);
return(ret);
}