home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a006 / 2.ddi / CEXAM.ZIP / DATEDEC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-11  |  834 b   |  33 lines

  1. #include <stdio.h>
  2. #include "pxengine.h"
  3.  
  4. #define TABLENAME            "table"
  5.  
  6. int main(void)
  7. {
  8.     int pxErr;
  9.     int month, day, year;
  10.     long date;
  11.     TABLEHANDLE tblHandle;
  12.     RECORDHANDLE recHandle;
  13.     FIELDHANDLE fldHandle;
  14.  
  15.     PXInit();
  16.     PXTblOpen(TABLENAME, &tblHandle, 0, 0);
  17.     PXRecBufOpen(tblHandle, &recHandle);
  18.     PXFldHandle(tblHandle,"Date Field",&fldHandle);
  19.     PXRecGet(tblHandle,recHandle);
  20.     PXGetDate(recHandle, fldHandle, &date);
  21.  
  22.     /* Decode the date that was just retrieved. */
  23.     if ((pxErr = PXDateDecode(date, &month, &day, &year)) != PXSUCCESS)
  24.         printf("%s\n", PXErrMsg(pxErr));
  25.     else
  26.         printf("Month: %d  Day: %d  Year: %d\n", month, day, year);
  27.  
  28.     PXRecBufClose(recHandle);
  29.     PXTblClose(tblHandle);
  30.     PXExit();
  31.     return(pxErr);
  32. }
  33.