[fpc-pascal] DateTimeToFileDate

Carsten Bager carsten at beas.dk
Fri Sep 12 11:49:21 CEST 2008


When I do this

Free Pascal Compiler version 2.2.2 [2008/07/29] for i386
---------------------
Program tt;
uses dos,
     sysutils;

function strPackTime(t:longWord):shortstring;
var
  dt:Datetime;
begin
  UnpackTime(t,dt);
  strPackTime:=intToStr(dt.day)+'/'+
         intToStr(dt.month)+'-'+
         intToStr(dt.year)+
         intToStr(dt.hour)+':'+
         intToStr(dt.min)+':'+
         intToStr(dt.sec)+' ';
end;

Begin
  WriteLn(strPackTime(DateTimeToFileDate(now)));
  
WriteLn(DateTimeToStr(FileDateToDateTime(DateTimeToFileDate(now))))
;
End.
---------------------------------

I get this result

9/6-20160:28:22
11-9-08 13:39:55

What am I doing wrong.

Carsten



More information about the fpc-pascal mailing list