home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a006 / 1.ddi / PASEXAM.ZIP / DATEDEC.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-03-11  |  815 b   |  31 lines

  1. program DateDec;
  2. uses PXEngine;
  3.  
  4. const TableName = 'Table';
  5.  
  6. var   PxErr: Integer;
  7.       TblHandle: TableHandle;
  8.       FldHandle: FieldHandle;
  9.       RecHandle: RecordHandle;
  10.       Month, Day, Year: Integer;
  11.       Date: TDate;
  12.  
  13. begin
  14.   PX(PXInit);
  15.   PX(PXTblOpen(TableName, TblHandle, 0, False));
  16.   PX(PXRecBufOpen(TblHandle, RecHandle));
  17.   PX(PXFldHandle(TblHandle, 'Date Field', FldHandle));
  18.   PX(PXRecGet(TblHandle, RecHandle));
  19.   PX(PXGetDate(RecHandle, FldHandle, Date));
  20.  
  21.   (* Decode the date that was just retrieved. *)
  22.   PxErr := PXDateDecode(date, Month, Day, Year);
  23.   if PxErr <> PxSuccess then
  24.     Writeln(PxErrMsg(PxErr))
  25.   else Writeln('Month: ', Month, '   Day: ', Day, '   Year: ', Year);
  26.  
  27.   PX(PXRecBufClose(RecHandle));
  28.   PX(PXTblClose(TblHandle));
  29.   PX(PXExit);
  30. end.
  31.