Associate
I seem to be having a bit of a problem with dates in PHP. I’ve got a multi-dimensional array, one of the columns contains a date string. I then want another column to show the week number, I’m using the following code to populate the array after extracting data from a database:
However, the final line seems to be getting the month and date transposed. For example, 4th January 2011 (04/01/2011) should be showing as week 1, but it’s coming back as week 13 as its seeing the date as 1st April 2011 (01/04/2011).
I’ve looked around trying to find a way to tell PHP to use dd/mm/yyyy but no joy so far. Anyone able to advise?
Thanks
Code:
$results[$i][0] = $f1->value;
$results[$i][1] = $f2->value;
$results[$i][2] = $f3->value;
$results[$i][3] = date("W", strtotime($f3->value));
However, the final line seems to be getting the month and date transposed. For example, 4th January 2011 (04/01/2011) should be showing as week 1, but it’s coming back as week 13 as its seeing the date as 1st April 2011 (01/04/2011).
I’ve looked around trying to find a way to tell PHP to use dd/mm/yyyy but no joy so far. Anyone able to advise?
Thanks