PHP浮点数时间戳转正常int型

WBOY
Release: 2016-06-20 13:05:03
Original
1310 people have browsed it

PHP浮点数时间戳转正常int型

做七牛云存储的时候,获取了一个文件列表,然后里面的文件上传时间返回值居然是double型的,如:1.3800892861427E+16

这怎么办?开始我用intval 转了 发现是64位的整形,不好弄,后来询问了

先截取后处理才能正确返回时间戳:

$a = '1.3800892861427E+16';
$a = strval($a);
$a = substr($a,0,11);
$a = bcmul($a,'1000000000');
//$a显示为了 1380089286 后面用date就好了
Copy after login


Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template