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;

相关阅读 >>

tstringgrid 添加鼠标拖动功能

Delphi access 导出 excel 表格

Delphi tstream 详细介绍

Delphi 对gzip解压

Delphi中webbrowser自动登录路由器网页

Delphi 如何获取窗口的图标

Delphi xe6 android拨号函数

Delphi idhttp控件学习(图片下载)

Delphi 申请管理员权限级别

Delphi中实现hextostr函数和strtohex函数

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



打赏

取消

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

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

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

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

评论

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