Thank you, both.
I'm using PHP version 5.3.14.
I made the mistake of assuming the echo line I quoted did the same as my actual code, which is operating slightly differently. When I actually tried that code as per Weedpacket's test, it works fine.
Could the problem be with my parsing of the CSV file?
Here's what I'm actually doing (with apologies for not simply quoting this in the first place).
$uploadfile = '/path/to/file.csv';
$file_handle = fopen($uploadfile, "r");
while (!feof($file_handle) ) {
$row = fgetcsv($file_handle, 1024);
if ($row[0] != ''){ // only proceed if first column not empty
if ($row[3] != ''){ // if this column is empty, there will not be dates to parse in the next 2 columns
$from = date('Y-m-d', strtotime($row[4]));
$to = date('Y-m-d', strtotime($row[5]));
print " source: $row[4] - $row[5] result: $from - $to<br />";
}
} // done checking if first column is empty
} // done all rows
fclose($file_handle);
This outputs:
source: 02-Jan-2012 - 13-Jul-2012 result: 1970-01-01 - 1970-01-01
source: 09-Jan-2012 - 03-Jun-2012 result: 1970-01-01 - 1970-01-01
source: 13-Apr-2012 - 31-May-2012 result: 1970-01-01 - 1970-01-01
source: 29-Feb-2012 - 24-Jun-2012 result: 1970-01-01 - 1970-01-01
source: 31-Oct-2011 - 22-Jun-2012 result: 1970-01-01 - 1970-01-01
I will of look into strptime too, never heard of that before, thank you Derokorian. But if I can get strtotime to work, that'll be simpler.
Thanks again