企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# PHP strftime() 函数 ## 定义和用法 strftime() 函数根据区域设置格式化本地时间/日期。 ### 语法 ``` strftime(format,timestamp) ``` | 参数 | 描述 | | --- | --- | | format | 可选。规定如何返回结果。 | | timestamp | 可选。 | ## 提示和注释 提示:与 [gmstrftime()](/php/func_date_gmstrftime.asp "PHP gmstrftime() 函数") 的行为相同,不同的是返回时间是本地时间。 ## 例子 输出 strftime() 和 gmstrftime() 的结果: ``` <?php echo(strftime("%b %d %Y %X", mktime(20,0,0,12,31,98))); echo(gmstrftime("%b %d %Y %X", mktime(20,0,0,12,31,98))); //输出当前日期、时间和时区 echo(gmstrftime("It is %a on %b %d, %Y, %X time zone: %Z",time())); ?> ``` 输出: ``` Dec 31 1998 20:00:00 Dec 31 1998 19:00:00 It is Wed on Jan 25, 2006, 11:32:10 time zone: W. Europe Standard Time ```