PHP: Hypertext Preprocessor (original) (raw)
`Please note that if you are using DATE_RFC7231 format (used in HTTP/1.1), you'll need to change the DateTime object timezone to GMT before, or you'll encounter weird results, as this format DOES NOT convert the date to GMT.
So if you have a DateTime object using UTC+01:00 as its timezone, you will get a difference of 1 hour between your resulting date string and what should be the "correct" date.
Recommended use:
dategmt=clonedate_gmt = clone dategmt=clonedate; $date_gmt->setTimezone(new \DateTimeZone('GMT')); echo $date_gmt->format(DATE_RFC7231); ?>`