MySQL and PHP Date Formt

Soldato
Joined
30 Nov 2005
Posts
3,084
Location
London
Can anyone tell me why it displays 01 Jan 1970 instead of my date in the database?

PHP:
echo date('d M Y',$row['time']);

Seems to me it's ignoring the $row
 
It's echoing the correct value on a seperate line (without the date function).

But when I try and format it as above it just reverts to 01 Jan 1970.
 
Thanks for the reply but it's still the same result 01 Jan 1970.

Could it be a problem at the database end? Do I have to change my select statement at all?

dateyl6.jpg


Can't see anything wrong here?
 
Dj_Jestar said:
Code:
SELECT UNIX_TIMESTAMP(`Date`) AS `TimeStamp` FROM `Table`

Ok now I'm confused.

Here is my current Select statement:

SELECT comp, time, firstteam, secondteam FROM upcoming

Which I echo all the above including:

echo date('d M Y', intval($row['time']));

But still have the same problem.
 
robmiller said:
Code:
$result = mysql_query("SELECT comp, UNIX_TIMESTAMP(time) AS stamp, firstteam, secondteam FROM upcoming");

while ( $row = mysql_fetch_assoc($result) ) {
    echo date('d M Y', $row['stamp']);
}

Thank you, thank you, thank you!

Can't believe something as simple as formatting a date caused some many problems.

Also thanks to all those that tried to help.
 
Back
Top Bottom