当前位置:首页 >> 网络编程

PHP时间和日期函数详解

PHP中所有函数都是UNIX纪元的,即从1970年1月1日开始的。

日期是从这个时候开始的秒数。

当一个函数调用从这时候计的秒数时,就把它当作(timestamp)时间戳。

本地时间函数

1. string date(string format,inieger timestamp)

该函数返回一个表示时间的字符串,是由string format 控制的。
如:

<"Y年 m月d日");//输出当前,年月日.
print(date("Y年 m月d日",60*60*24*365*10);//输出1980年1月1日.
"htmlcode">
<"hours"));
print($current_date("minutes");
print($current_date("seconds");
"htmlcode">