博客
关于我
Java存储数据库中时间戳和php操作数据库时间戳的关系
阅读量:684 次
发布时间:2019-03-17

本文共 358 字,大约阅读时间需要 1 分钟。

一直困扰我的问题终于得到了解决!刚开始以为是系统的问题,后来通过代码测试发现系统是正常的。问题主要出在时间戳的处理上。我在试图用strtotime()date(format,time())函数之间徘徊,因为有时会得到不将正确的时间显示。

在经过一番调试后,我发现当在32位系统中存储时间戳时,使用substr()函数来截断多余的三位,确实可以得到正确的时间戳值。然后将截断后的10位时间戳值传递给date(format,time())进行格式化,最终问题得以解决。

数据库中存储的是13位的时间戳,这是因为32位系统中时间戳只能表示到2038年。通过截断后三位,我在数据库中得到的是正确的10位时间戳,这样处理后,日期和时间显示也就准确了。

通过这一系列的尝试和调整,我终于找到了解决问题的办法,感觉心情非常舒畅!

转载地址:http://obdhz.baihongyu.com/

你可能感兴趣的文章
npm ERR! Unexpected end of JSON input while parsing near '...on":"0.10.3","direc to'
查看>>
npm ERR! Unexpected end of JSON input while parsing near ‘...“:“^1.2.0“,“vue-html-‘ npm ERR! A comp
查看>>
npm error Missing script: “server“npm errornpm error Did you mean this?npm error npm run serve
查看>>
npm error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装
查看>>
npm install CERT_HAS_EXPIRED解决方法
查看>>
npm install digital envelope routines::unsupported解决方法
查看>>
npm install 卡着不动的解决方法
查看>>
npm install 报错 EEXIST File exists 的解决方法
查看>>
npm install 报错 ERR_SOCKET_TIMEOUT 的解决方法
查看>>
npm install 报错 Failed to connect to github.com port 443 的解决方法
查看>>
npm install 报错 fatal: unable to connect to github.com 的解决方法
查看>>
npm install 报错 no such file or directory 的解决方法
查看>>
npm install 权限问题
查看>>
npm install报错,证书验证失败unable to get local issuer certificate
查看>>
npm install无法生成node_modules的解决方法
查看>>
npm install的--save和--save-dev使用说明
查看>>
npm node pm2相关问题
查看>>
npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
查看>>
npm run build报Cannot find module错误的解决方法
查看>>
npm run build部署到云服务器中的Nginx(图文配置)
查看>>