PHP | gmdate() Function (original) (raw)

Last Updated : 11 Jul, 2025

The gmdate() is an inbuilt function in PHP which is used to format a GMT/UTC date and time and return the formatted date strings. It is similar to the date() function but it returns the time in Greenwich Mean Time (GMT).Syntax:

string gmdate ( format,format, format,timestamp )

Parameters: The gmdate() function accepts two parameters as mentioned above and described below:

Return Value: This function Returns a formatted date string on success and FALSE on failure and an E_WARNING. Below programs illustrate the gmdate() function.Program 1:

php `

`

Output:

Jun 25 2018 23:21:50 2018-06-25T23:21:50+00:00 2018-06-25T23:21:50+0000

Program 2: Passing one parameter, then it will return the current local time (time()).

php `

`

Output:

Jun 29 2018 06:32:34 2018-06-29T06:32:34+00:00 2018-06-29T06:32:34+0000

Similar Article:

Reference: https://www.php.net/manual/en/function.gmdate.php