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

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

WBOY
WBOYOriginal
2016-06-13 13:49:271152browse

如何将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 ");
?>

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

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