| OptDate2Month Function | 
Unit
QESBPCSDateTime
Declaration
Function OptDate2Month(const DT: TDateTime): Word;
Category
Date/Time Conversion RoutinesImplementation
 
| function OptDate2Month (const DT: TDateTime): Word;
var
     J: Integer;
     Day, Month, Year: 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;
     if Month < 10 then
          Inc (Month, 3)
     else
          Dec (Month, 9);
     Result := Month
End; | 
|  |