home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / EZY110-1.ARJ / STRUCT.ARJ / CLIB.ARJ / DATE2.CPP < prev    next >
C/C++ Source or Header  |  1995-03-28  |  582b  |  23 lines

  1. #include <ezycom.h>
  2. #include <ezylib.h>
  3.  
  4. /**********************************************************
  5.  * Convert a Date to a Word
  6.  *
  7.  * Returns the converted date on success or 65535 on failure.
  8.  *
  9.  * eg: worddate = date2word(1992,1,1);
  10.  **********************************************************/
  11. word Date2Word(word yy, word mm, word dd)
  12. {
  13.     word tofield=0;
  14.  
  15.     if (!CheckDate(yy,mm,dd) || yy < 1980 || yy > 2107) return(65535U);
  16.  
  17.     tofield = dd-1;
  18.     tofield = tofield + ((mm-1) << 5);
  19.     tofield = tofield + ((yy-1980) << 9);
  20.  
  21.     return(tofield);
  22. }
  23.