delphi java 日期 转换 获取Unix时间戳


本文整理自网络,侵删。

 
uses system.DateUtils;

//将Java中的日期转换为Delphi中的日期
function ConvertJavaDateTimeToDelphiDateTime(Value: Int64): TDateTime;
begin
   Result := IncMilliSecond(StrToDate('1970-01-01'), Value);
end;

//将Delphi中的日期转换为Java中的日期
function ConvertDelphiDateTimeToJavaDateTime(ADateTime: TDateTime): Extended;
var
   dt: TDateTime;
   dtVal: double;
begin

    if not TryStrToDate('1970-01-01', dt) then
    begin
       dtVal := 25569;
       dt := dtVal;
    end;
    Result := MilliSecondSpan(ADateTime, dt);
end;

相关阅读 >>

Delphi 监视剪贴板内容

Delphi 带密匙的字符串加密解密函数(支持中文)

Delphi 字符串截取

Delphi zlib 流压缩解压

Delphi如何生成一段时间内的所有日期

Delphi runtime error 216 程序退出后弹出错误

Delphi firedac压缩和修复ms access数据库

Delphi字符串隐藏

Delphi 实现窗口与任务栏右下角对齐

Delphi的datetostr strtodate格式灵活用法

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



打赏

取消

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

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

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

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

评论

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