I am writing a PHP script to automatically download a CSV file.
When I manually visit the URL from the web-browser(safari) and download the file and open it in MS Excel, columns A and D (date and time respectively) are formatted as I would expect, e.g. '12-Sep-16' and '3:00:30 pm'. However, when I run the below PHP script:
$url_="";
$filename="File.csv";
file_put_contents('/home/file/path' . $filename, file_get_contents($url));
The file downloads, and the content is fine apart from columns A & D, which are formatted as follows 'Mon Sep 12 00:00:00 EDT 2016' and 'Mon Sep 13 10:00:30 EDT 2016'.
My server timezone is set to 'Europe/London'.
Clearly either file_get_contents(); file_put_contents(); is changing something. Would anyone happen to know how I can resolve this?