How to convert the value reported by the If-Modified-Since header into a PHP date (and vice versa)?

1

The header If-Modified-Since displays the following format of return:

Wed, 21 Oct 2015 07:28:00 GMT

I need to compare this date in this header item with the date a file was created on my server, using the filemtime($arquivo) function.

I want to do two things:

  • Transform If-Modified-Since into a valid PHP date to compare it with date returned in filemtime .

  • Transform the return of filemtime to a date in the format equal to the header If-Modified-Since , to send as header Last-Modified to the negavador.

So the question is:

  • Is there a default in PHP to format the date of this header? And if it has a default, does this date format have a name?
asked by anonymous 23.10.2018 / 15:48

0 answers