The date code is a 32 bit value specifying the start time of the block. Bits 0-16 contain the number of seconds since midnight, and bits 17-31 the number of days since 17th November 1989.
function DecodeTime(time : dword) : string;
begin
result := IntTo2str(time div 3600)+':'+
IntTo2Str((Time mod 3600) div 60)+':'+
IntTo2Str(Time mod 60);
end;
function DecodeDate(days : dword) : string;
const
daycount : array[0..11] of integer =
(31,28,31,30,31,30,31,31,30,31,30,31);
var
year,month,day : word;
function IsLeapYear(year : word) : boolean;
begin
IsLeapYear := (Year mod 4 = 0) and
((Year mod 100 <> 0) or (Year mod 400 = 0));
end;
begin
year := 1989;
month := 10; { note that month and day are zero referenced }
day := 0;
inc(days,16); { The number of ‘days’ is referenced from 17 Nov 1989 }
{ Account for leap years }
if IsLeapYear(Year) then
daycount[1] := 29;
while days>=daycount[month] do
begin
days := days - daycount[month];
year := year + (month + 1) div 12;
month := (month + 1) mod 12;
if IsLeapYear(year) then
daycount[1] := 29
else
daycount[1] := 28;
end;
Result := IntToStr(days+1)+'/'+IntToStr(month+1)+'/'+IntToStr(year);
end;