超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<gmmktimeidate>
Last updated: Fri, 22 Jun 2007

gmstrftime

(PHP 3>= 3.0.12, PHP 4 , PHP 5)

gmstrftime --  根据区域设置格式化 GMT/UTC 时间/日期

说明

string gmstrftime ( string format [, int timestamp])

strftime() 的行为相同,只除了返回时间是格林威治标准时(GMT)。例如,当在东部标准时(EST,GMT -500)运行时,下面第一行显示“Dec 31 1998 20:00:00”,而第二行显示“Jan 01 1999 01:00:00”。

例子 1. gmstrftime() 例子

<?php
setlocale
(LC_TIME, 'en_US');
echo
strftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n";
echo
gmstrftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n";
?>

参见 strftime()




add a note add a note User Contributed Notes
gmstrftime
neo at gothic-chat d0t de
25-Jun-2004 02:27
To get a RFC 850 date (used in HTTP) of the current time:

gmstrftime ("%A %d-%b-%y %T %Z", time ());

This will get for example:
Friday 25-Jun-04 03:30:23 GMT

Please note that times in HTTP-headers _must_ be GMT, so use gmstrftime() instead of strftime().

<gmmktimeidate>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22