Home > Backend Development > PHP Tutorial > 怎么将2007-04-24 03:19:32格式时间转成时间戳

怎么将2007-04-24 03:19:32格式时间转成时间戳

WBOY
Release: 2016-06-13 13:49:27
Original
1206 people have browsed it

如何将2007-04-24 03:19:32格式时间转成时间戳?
echo   strtotime( "2007-04-24 03:19:32 ");
echo   time( "2007-04-20 03:19:32 ");
我这样都不行啊,第一个什么都没有输出,第二个变成当前时间的时间戳。

------解决方案--------------------
$datetime=split( " ", "2007-04-24 03:19:32 ");
$date=split( "- ",$datetime[0]);
$time=split( ": ",$datetime[1]);

echo mktime($time[0],$time[1],$time[2],$date[1],$date[2],$date[0]);

测试下!

------解决方案--------------------
echo strtotime( "2007-04-24 03:19:32 ");
?>

日期和时间中间不要用中文空格!

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template