| OptDecodeDateI Procedure | 
Unit
QESBPCSDateTime
Declaration
Procedure OptDecodeDateI(const DT: TDateTime; out Year, Month, Day: Integer);
Description
If you need Words rather than Integers use the slightly slower OptDecodeDateW.
Category
Date/Time Conversion RoutinesImplementation
 
| procedure OptDecodeDateI (const DT: TDateTime; out Year, Month, Day: Integer);
var
     J: Integer;
begin
     J := pred ((Trunc (DT) + 693900) shl 2);
     Year := J div 146097;
     Day := (J - 146097 * Year) shr 2;
     J := (Day shl 2 + 3) div 1461;
     Day := (Day shl 2 + 7 - 1461 * J) shr 2;
     Month := (5 * Day - 3) div 153;
     Day := (5 * Day + 2 - 153 * Month) div 5;
     Year := 100 * Year + J;
     if Month < 10 then
          Inc (Month, 3)
     else
     begin
          Dec (Month, 9);
          Inc (Year);
     end;
End; | 
|  |