I'm using an API right now and it provides an epochTime. I've tried everything to convert this epochtime to date, but it doesn't seem to be working including $epoch_time / 1000 and then using the date() function to convert it.

我现在正在使用API​​,它提供了一个epochTime。我已经尝试了将这个纪元时间转换为日期的所有内容,但它似乎没有工作,包括$ epoch_time / 1000然后使用date()函数来转换它。

The epoch time looks something like this 1353430853299. Is there a way to do this? strtotime() did not work either.

纪元时间看起来像1353430853299.有没有办法做到这一点? strtotime()也没有用。

It seems that all of the other readings about epoch time are about changing date to epochtime, but I'm looking to go the other way around. Any help is greatly appreciated.

似乎关于纪元时间的所有其他读数都是关于将日期更改为纪元时间,但我希望反过来。任何帮助是极大的赞赏。

5 个解决方案

#1


28

Fixed it using substr($epoch, 0, 10) and then used the date function for anyone wondering about the 13 digit epoch times.

使用substr($ epoch,0,10)修复它,然后对任何想知道13位纪元时间的人使用日期函数。

Here is a sample code:

这是一个示例代码:

echo date("Y-m-d H:i:s", substr("1477020641000", 0, 10));
// Result: 2016-10-20 20:30:41

更多相关文章

  1. 如何减去两个日期和时间来得到不同?
  2. 随手小记:PHP-FPM模式下PHP最大执行时间、Pragma和post-check
  3. PHP 导出 万级别数据 时间测试
  4. PHP结合Redis来限制用户或者IP某个时间段内访问的次数
  5. 使用Laravel在PHP中按时间戳,后端过滤SQL数据库查询
  6. 在PHP中如何取得两个日期时间相减的结果,得出大于一天,大于二天,大
  7. 如何检查时间偏移是否在夏令时?
  8. 如何解决一段时间真正的循环,因为它昂贵且危险
  9. php 显示某一个时间相当于当前时间在多少秒前,多少分钟前,多少小时

随机推荐

  1. php的优势与缺点
  2. php怎么接入公众号
  3. php依赖注入的三种方式
  4. php如何获取上传文件大小
  5. php怎么换行输出
  6. php中定义常量的两种方法
  7. php怎么跟数据库连接
  8. 使用PHP多维数组重组方法,兼容API接口
  9. php 字符串替换方法
  10. php怎么给密码进行md5加密