博客
关于我
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报错fatal: Could not read from remote repository
查看>>
npm报错File to import not found or unreadable: @/assets/styles/global.scss.
查看>>
npm报错TypeError: this.getOptions is not a function
查看>>
npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
查看>>
npm淘宝镜像过期npm ERR! request to https://registry.npm.taobao.org/vuex failed, reason: certificate has ex
查看>>
npm版本过高问题
查看>>
npm的“--force“和“--legacy-peer-deps“参数
查看>>
npm的安装和更新---npm工作笔记002
查看>>
npm的常用操作---npm工作笔记003
查看>>
npm的常用配置项---npm工作笔记004
查看>>
npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
查看>>
npm编译报错You may need an additional loader to handle the result of these loaders
查看>>
npm设置淘宝镜像、升级等
查看>>
npm设置源地址,npm官方地址
查看>>
npm设置镜像如淘宝:http://npm.taobao.org/
查看>>
npm配置安装最新淘宝镜像,旧镜像会errror
查看>>
NPM酷库052:sax,按流解析XML
查看>>
npm错误 gyp错误 vs版本不对 msvs_version不兼容
查看>>
npm错误Error: Cannot find module ‘postcss-loader‘
查看>>
npm,yarn,cnpm 的区别
查看>>