PHP时间和日期函数详解

(编辑:jimmy 日期: 2025/6/28 浏览:2)

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">
<"日期合法!n");
"htmlcode">
<"htmlcode">
<"H");
print("50个小时后为:");
print(date("h:i A l F dS,Y",mktime($currenthour+50)));
print("<br>n");
"htmlcode">
<"start:microtime()<br>n");
for($index=0;$index<1000;$index++)
print("good!");
print("stop:microtime()<br>n");
?>

还有,各林威治标准时间函数

以上所述就是本文的全部内容了,希望大家能够喜欢。

一句话新闻

微软与英特尔等合作伙伴联合定义“AI PC”:键盘需配有Copilot物理按键
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。