strtotime() - 语法
int strtotime ( string $time [, int $now] );
该函数期望得到一个包含美国英语日期格式的字符串,并将尝试将该格式解析为Unix时间戳,该时间戳与Now中给定的时间戳相关,如果没有提供,则解析为当前时间。
Sr.No | Parameter & Description |
---|---|
1 |
time(必需) 它指定要解析的时间字符串 |
2 |
now(可选) 用于计算返回值的时间戳。 |
strtotime() - 返回值
它在成功时返回时间戳,否则返回false。在PHP 5.1.0之前的版本中,此函数在失败时将返回-1。
strtotime() - 示例
<?php $timestamp=strtotime( "February 15, 2015" ); print date( 'Y-m-d', $timestamp ); ?>
这将产生以下输出-
2015-02-15