OptDecodeDateW Procedure |
Unit
QESBPCSDateTime
Declaration
Procedure OptDecodeDateW(const DT: TDateTime; out Year, Month, Day: Word);
Description
If you want even faster results and are happy to use Integers than use the slightly slower OptDecodeDateI.
Category
Date/Time Conversion RoutinesImplementation
procedure OptDecodeDateW (const DT: TDateTime; out Year, Month, Day: Word); 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; |
|