Definition and Usage
The gmstrftime() function formats a GMT/UTC time or date according to locale settings.Syntax
gmstrftime(format,timestamp)
| Parameter | Description |
|---|---|
| format |
Required. Specifies how to return the result:
|
| timestamp | Optional. Specifies the date or time to be formatted. If no timestamp is specified, it uses the current GMT time. |
Tips and Notes
Tip: This function is identical to strftime() except that the time returned is Greenwich Mean Time (GMT).Example
Example of both strftime() and gmstrftime():
<?php
echo(strftime("%b %d %Y %X", mktime(20,0,0,12,31,98))."<br />");
echo(gmstrftime("%b %d %Y %X", mktime(20,0,0,12,31,98))."<br />");
//Print the current date, time, and time zone.
echo(gmstrftime("It is %a on %b %d, %Y, %X time zone: %Z",time()));
?>
echo(strftime("%b %d %Y %X", mktime(20,0,0,12,31,98))."<br />");
echo(gmstrftime("%b %d %Y %X", mktime(20,0,0,12,31,98))."<br />");
//Print the current date, time, and time zone.
echo(gmstrftime("It is %a on %b %d, %Y, %X time zone: %Z",time()));
?>
OUTPUT :
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
Dec 31 1998 19:00:00
It is Wed on Jan 25, 2006, 11:32:10 time zone: W. Europe Standard Time