PHP gmstrftime() Function
Example
Format GMT/UTC date and time according to locale settings:
<?php
echo(gmstrftime("%B %d %Y, %X %Z",mktime(20,0,0,12,31,98))."<br>");
setlocale(LC_ALL,"hu_HU.UTF8");
echo(gmstrftime("%Y. %B %d. %A. %X %Z"));
?>
Try it Yourself »
Definition and Usage
The gmstrftime() function formats a GMT/UTC time and/or date according to locale settings.
Note: This function was deprecated in PHP 8.1.0.
Tip: Also look at the strftime() function, which formats a local time and/or date according to locale settings.
Syntax
gmstrftime(format, timestamp)
Parameter Values
| Parameter | Description |
|---|---|
| format | Required. Specifies how to return the result:
|
| timestamp | Optional. Specifies a Unix timestamp that represents the date and/or time to be formatted. Default is the current local time (time()) |
Technical Details
| Return Value: | Returns a string formatted according format using the given timestamp. Month and weekday names and other language-dependent strings respect the current locale set with setlocale() |
|---|---|
| PHP Version: | 4+ |
❮ PHP Date/Time Reference