🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# PHP gmstrftime() 函数 ## 定义和用法 gmstrftime() 函数根据本地区域设置格式化 GMT/UTC 时间/日期。 ### 语法 ``` gmstrftime(format,timestamp) ``` | 参数 | 描述 | | --- | --- | | format | 可选。规定如何返回结果。 | | timestamp | 可选。 | ## 提示和注释 提示:与 [strftime()](/php/func_date_strftime.asp "PHP strftime() 函数") 的行为相同,不同的是返回时间是格林威治标准时(GMT)。 ## 例子 输出 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 ```