
PHP 提供了函数可以方便的将各种形式的日期转换为时间戳,该类函数主要是:
strtotime():将任何英文文本的日期时间描述解析为时间戳。
mktime():从日期取得时间戳。
strtotime()
立即学习“PHP免费学习笔记(深入)”;
strtotime() 函数用于将英文文本字符串表示的日期转换为时间戳,为 date() 的反函数,成功返回时间戳,否则返回 FALSE 。
语法:
int strtotime ( string time [, int now] )
示例:
"; //输出明天此时的时间戳 ?>
mktime()
mktime() 函数用于从日期取得时间戳,成功返回时间戳,否则返回 FALSE 。
语法:
int mktime(时, 分, 秒, 月, 日, 年)
示例:
更多相关教程请关注php中文网。











