Home >php教程 >php手册 >php中的time(),date(),mktime(),strtotime()

php中的time(),date(),mktime(),strtotime()

WBOY
WBOYOriginal
2016-06-13 08:50:271385browse

php中的time(),date(),mktime(),strtotime()

time():返回当前的Unix时间戳;

date():格式化一个本地的时间戳;

mktime(时,分,秒,月,日,年):取得一个日期的时间戳;

strtotime():将任何英文文本的日期时间描述解析为Unix时间戳

echo time();

echo date('Y-m-d H:i:s',time());

echo mktime(13,54,55,9,18,2015);

echo strtotime("now");

echo strtotime("10 September 2015");

echo strtotime("+1 day");

echo strtotime("+1 week");

echo strtotime("next Thursday");

echo strtotime("last Monday");

 

Statement:
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