Display date problem

I am trying to tidy up some old code and have a date problem. I must have had the same problem a few years ago as the display date code was commented out.

No mater what the date in the database is it is always displaying 6th August 2016 although the dates I have tried were all from 2016.

Anyway I did some tests and it looks like the Unix time stamp in the database is OK so it must be something I am doing in php but I can not see what!

echo '<br>Unix from database='.$row2->date_time;
echo '<br>Hard coded='.date("jS F Y", 1481414461);
echo '<br>Date: '.date('jS F Y', $row2->date_time).'<br />';

( I also tried putting $row2->date_time into a variable and the calling the variable in the date() function with the same result )

The above outputs
Unix from database=1481414461
Hard coded=11th December 2016
Date: 6th August 2016

Correct output from an online unix converter: Sun, 11 Dec 2016 00:01:01 GMT

I do not know why but it is now working OK.

I changed my query to include a where clause and that my be what fixed it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.