Home > php教程 > php手册 > body text

PHP 时间、int、字符串转换

WBOY
Release: 2016-06-06 19:46:43
Original
856 people have browsed it

$timestamp=12100003300; //from 1970/1/1 0:0:0$datetime=date(Y-m-d H:i:s , $timestamp);strtotime($datetime)echo date(Y/m/d)time() ; //当前时间戳 getdate(时间) microtime(); 返回一个字符串,用空分成两部分,后一部分相当于time() 用法: date(式,[时

$timestamp=12100003300;   //from 1970/1/1 0:0:0
$datetime=date('Y-m-d H:i:s' , $timestamp);

strtotime($datetime)

echo date('Y/m/d')

time()  ; //当前时间戳
Copy after login


getdate(时间)

microtime(); 返回一个字符串,用空格分成两部分,后一部分相当于time()

用法: date(格式,[时间]);

当天:        

$now=getdate( time());
        $today=mktime(0,0,0,$now['mon'],$now['mday'],$now['year']);

Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!