delphi 时间戳与日期互转


本文整理自网络,侵删。

 

1、日期转换成时间戳

function Gettimestamp: string;
begin
 Result := inttostr(DateTimeToUnix(IncHour(Now,-8))); //  本地时间减8小时
end;





2、时间戳转换成日期

function UnixDateToDateTime(const USec: Longint): TDateTime;
const
UnixStartDate: TDateTime = 25569.0; // 1970/01/01
begin
Result:= (Usec / 86400) + UnixStartDate;
Result:= IncHour(Result,8);
end;

相关阅读 >>

Delphi删除目录及子目录及所有目录下的文件

Delphi debug模式下可以但是release模式下报错原因之一

Delphi winapi: shellexecute - 打开外部程序或文件

Delphi 保证当前程序显示在最前

Delphi 建立access数据库

wmi技术介绍和应用

Delphi 执行程序并等待完成2

Delphi 限制窗体大小的最大值与最小值

Delphi 关于运算符

Delphi hex --> string

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...