Home > Articles

Date and Time

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Using GMT Date/Time Information

Usually, PHP takes the local settings for time formats. However in some special cases, the GMT time format must be used. For this, PHP offers "GMT-enabled" versions of some of its date/time functions:

  • gmdate() works like date() and formats a date/time value; however, the return value uses GMT format

  • gmmktime() creates a time stamp like mktime(); however, it uses GMT

  • gmstrftime() formats a time as strftime() does; however, it uses GMT

GMT is important when it comes to setting a page's expiry date in an HTTP header or manually setting the expiry date of a cookie, also in the HTTP header.

  • + Share This
  • 🔖 Save To Your Account