Delphi中的FileDateToDateTime函数具体是如何实现的? 当用FileAge获取文件整数时间表示后,要用FileDateToDateTime转化为本地时间,FileDateToDateTime是如何实现的呢?换句话说,就是FileAge获取文件整数时间是按什么规则表示的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是对FileDate进行位操作,参考FileDateToDateTime的代码:function FileDateToDateTime(FileDate: Integer): TDateTime;{$IFDEF MSWINDOWS}begin Result := EncodeDate( LongRec(FileDate).Hi shr 9 + 1980, LongRec(FileDate).Hi shr 5 and 15, LongRec(FileDate).Hi and 31) + EncodeTime( LongRec(FileDate).Lo shr 11, LongRec(FileDate).Lo shr 5 and 63, LongRec(FileDate).Lo and 31 shl 1, 0);end; 太感谢2楼的拉,能不能顺便再把 DateTimeToFileDate 的实现也贴出来,然后我就结贴了 将光标移到DateTimeToFileDate,按右键选Find Declaration,就可以跳动实现的代码了。function DateTimeToFileDate(DateTime: TDateTime): Integer;{$IFDEF MSWINDOWS}var Year, Month, Day, Hour, Min, Sec, MSec: Word;begin DecodeDate(DateTime, Year, Month, Day); if (Year < 1980) or (Year > 2107) then Result := 0 else begin DecodeTime(DateTime, Hour, Min, Sec, MSec); LongRec(Result).Lo := (Sec shr 1) or (Min shl 5) or (Hour shl 11); LongRec(Result).Hi := Day or (Month shl 5) or ((Year - 1980) shl 9); end;end; 有个简单的问题,小弟不解,求CSDN朋友相助!!!!!!在线等!!! [求助]怎样能把表1的某一数据关联到表2中? 要用DELPHI写WEB程序,第一步要如何实现?它需要什么环境? 老板今天叫我签合同 如何使程序不出现在任务列表中? 怎样动态改变Image的图片? 如何写注册表! delphi 如何进行语音对讲 edit里面可以控制它输入的内容格式吗?! 绝对难题:在大富翁和CSDN上都没人能答的问题!我查过的,此类帖子无一结帐,都是无果而终! 开发一个调用IE的程序 如何得到一个字符串的16进制编码?
function FileDateToDateTime(FileDate: Integer): TDateTime;
{$IFDEF MSWINDOWS}
begin
Result :=
EncodeDate(
LongRec(FileDate).Hi shr 9 + 1980,
LongRec(FileDate).Hi shr 5 and 15,
LongRec(FileDate).Hi and 31) +
EncodeTime(
LongRec(FileDate).Lo shr 11,
LongRec(FileDate).Lo shr 5 and 63,
LongRec(FileDate).Lo and 31 shl 1, 0);
end;
{$IFDEF MSWINDOWS}
var
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
DecodeDate(DateTime, Year, Month, Day);
if (Year < 1980) or (Year > 2107) then Result := 0 else
begin
DecodeTime(DateTime, Hour, Min, Sec, MSec);
LongRec(Result).Lo := (Sec shr 1) or (Min shl 5) or (Hour shl 11);
LongRec(Result).Hi := Day or (Month shl 5) or ((Year - 1980) shl 9);
end;
end;