Home > Backend Development > PHP Tutorial > php strtotime function UNIX timestamp_PHP tutorial

php strtotime function UNIX timestamp_PHP tutorial

WBOY
Release: 2016-07-21 15:47:51
Original
741 people have browsed it

If the format of time is absolute time, the now parameter has no effect. If the format of time is a relative time then the relative time is provided by now, or the current time if no now argument is provided. Returns -1 on failure.

echo strtotime ("now"), "n";
echo strtotime ("10 September 2000"), "n";
echo strtotime ("+ 1 day"), "n";
echo strtotime ("+1 week"), "n";
echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "n";
echo strtotime ("next Thursday"), "n";
echo strtotime ("last Monday"), "n";
?>$str = 'Not Good ';
if (($timestamp = strtotime($str)) === -1) {
echo "The string ($str) is bogus";
} else {
echo " $str == ".date('l dS of F Y h:i:s A',$timestamp);
}
?>
This effect is the same as using mktime().

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319828.htmlTechArticleIf the format of time is absolute time, the now parameter has no effect. If the format of time is a relative time, the relative time is provided by now, or if the now parameter is not provided, when...
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