views:

327

answers:

2

I have an Apache directory listing of files on a remote server (in Australia/Adelaide +930) I have no control over. This server shows the correct last modified date of a file as: 14-Aug-2009 09:41

I have a PHP script on my US server to check the date of the remote file. get_headers()['Last-Modified'] returns: Fri, 14 Aug 2009 00:11:11 GMT

How do I get my PHP script to output the same as Apache?

+1  A: 

The HTTP headers which returns from get_headers() is pushing out GMT time per the HTTP standard. What is your time zone on your server?

Daniel A. White
I thought it could be differing server times, but I've added putenv("TZ=Australia/Adelaide"); to no affect
Peter
@Peter, that'll only have an effect on PHP's date and time functions...
jason
+4  A: 

You're in Adelaide, Australia, which is GMT +9:30. get_headers() is giving you GMT time. apache is giving you local time.

Rob