- Using Text Within date()
- Automatically Localizing Dates
- Manually Localizing Dates
- Using the Current Date the U.S./U.K./European Way
- Formatting a Specific Date
- Validating a Date
- Calculating a Relative Date
- Creating a Sortable Time Stamp
- Converting a String into a Date
- Determining Sunrise and Sunset
- Using Date and Time for Benchmarks
- Using Form Fields for Date Selection
- Create Self-updating Form Fields for Date Selection
- Calculating the Difference Between Two Dates
- Using GMT Date/Time Information
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.