PHP | gmstrftime() Function Last Updated : 31 Aug, 2018 Comments Improve Suggest changes Like Article Like Report The gmstrftime() function is an inbuilt function in PHP which is used to format a GMT/UTC time/date according to local settings. The gmstrftime() function in PHP behaves in the same way as strftime() except that the time returned by the gmstrftime() function is Greenwich Mean Time (GMT). The $format and $timezone are sent as parameters to the gmstrftime() function and returns a string formatted according to the format specified using the given timestamp. Syntax: string gmstrftime( $format, $timestamp ) Parameters: This function accepts two parameters as mentioned above and described below: $format: It is a mandatory parameter which is used to specify the format of result. $timestamp: It is an optional parameter which is used to specify the UNIX timestamp that represents the date and/or time to be formatted. Return Value: This function returns a formatted string according to the format specified by the given timestamp. Exceptions: Month, weekday names and other language-dependent strings respect the current locale set with setlocale() function. If a timestamp is not given in the gmstrftime() function, it defaults to the value of time() or in other words to the current local time. Below programs illustrate the gmstrftime() function in PHP: Program 1: php <?php // Using gmstrftime() function to return the GMT time echo(gmstrftime("%B %d %Y, %X %Z", mktime(14, 0, 0, 8, 31, 18))); ?> Output: August 31 2018, 14:00:00 GMT Program 2: php <?php // Using gmstrftime() function to return the GMT time setlocale(LC_ALL, 'en_US'); echo(gmstrftime("%B %d %Y, %X %Z")); ?> Output: August 31 2018, 09:55:21 GMT Related Articles: PHP | strtotime() Function PHP | strptime() Function Reference: http://php.net/manual/en/function.gmstrftime.php Comment More infoAdvertise with us Next Article PHP | gmstrftime() Function S Shubrodeep Banerjee Follow Improve Article Tags : Misc Web Technologies PHP PHP-date-time PHP-function +1 More Practice Tags : Misc Similar Reads PHP | gmmktime() Function The gmmktime() function is an inbuilt function in PHP which is used to return the Unix timestamp for a GMT date. The $hour, $minute, $second, $month, $day, $year and $is_dst are sent as parameters to the gmmktime() function and it returns an integer Unix timestamp on success or False on error. Synta 2 min read PHP | mktime() Function The mktime() function is an inbuilt function in PHP which is used to return the Unix timestamp for a date. The timestamp returns a long integer containing the number of seconds between the Unix Epoch (January 1, 1970, 00:00:00 GMT) and the time specified. The hour, minute, second, month, day and yea 2 min read PHP | hrtime() Function The hrtime() function is an inbuilt function in PHP which returns the high-resolution time of the system. Syntax: mixed hrtime( bool $is_num_return ); Parameter: This function accepts a single parameter as mentioned above and described below: $is_num_return: It is optional parameter of Boolean type. 1 min read PHP | microtime() Function The microtime() function is an inbuilt function in PHP which is used to return the current Unix timestamp with microseconds. The $get_as_float is sent as a parameter to the microtime() function and it returns the string microsec sec by default. Syntax: microtime( $get_as_float ) Parameters: This fun 2 min read PHP | gmdate() Function 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, $timestamp ) Parameters: The gmdate() function 2 min read PHP | gettimeofday() Function The gettimeofday() function is an inbuilt function in PHP which is used to return the current time. It is an interface to Unix system call gettimeofday(2). It returns an associative array containing the data returned from the system call. The float option is sent as a parameter to the gettimeofday() 2 min read PHP | getdate() Function The getdate() function is an inbuilt function in PHP which is used to get date/time information of the current local date/time. Syntax: getdate($timestamp) Parameters: The getdate() function accepts one parameter and it is described below: $timestamp: It is an optional parameter which specifies an i 2 min read PHP | strftime() Function The strftime() function is an inbuilt function in PHP that formats local time or date according to locale settings i.e. it formats local time or date for location set for it of a place. Syntax: strftime( $format, $timestamp ) Parameters: This function accept two parameters as mentioned above and des 5 min read PHP | localtime() Function The localtime() function is an inbuilt function in PHP which is used to return the local time. The array returned by the localtime() function is similar to the structure returned by the C function call. The $timestamp and $is_associative are sent as parameters to the localtime() function and it retu 2 min read PHP | strptime() Function The strptime() function is an inbuilt function in PHP which is used to parse a time / date generated with strftime() function. The date and format are sent as a parameter to the strptime() function and it returns an array on success or False on failure. The array returned by the strptime() function 2 min read Like