PHP gmstrftime() Function

What is a gmstrftime Function?


The "gmstrftime()" function is used to format a GMT/UTC time/date according to local settings.



In the above syntax the parameters for the function are "format", which specifies the format of the output, "timestamp", is a default field which specifies date or time to be formatted, if not specified it will take default GMT Time.

Example :

echo(strftime("%b %d %Y %X", mktime(20,0,0,12,31,98)));
echo(gmstrftime("%b %d %Y %X", mktime(20,0,0,12,31,98)));
//Print the current date, time, and timezone.
echo(gmstrftime("It is %a on %b %d, %Y, %X time zone: %Z",time()));
Result :

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

In the above example the gmstrftime() function first returns the values without formatting, the second one returns the values in the desired string format.

Note :

(PHP 4, PHP 5)

PHP Topics

Ask Questions

Ask Question