I am new to PHP and just trying to learn a few things about it. I have some information in a MySql database that I have created. I am able to select the date, return the results, etc. But for some reason the timestamp is way off. I am not sure what I am missing. If you convert 1303564820015 I should get Sat, 23 Apr 2011 13:20:20 UTC but instead my year is 1903? I am sure I am missing something simple, like subtract 1970 from this date or add it, but right now it is kicking my butt.
Here is my code if some could take a look, and let me know where my mistake is I would appreciate it.
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("niagara", $con);
$result = mysql_query("SELECT * FROM dashboard_dischargeairtemp");
while($row = mysql_fetch_array($result))
{
echo date ('m/d/Y h:i:s a', $row['TIMESTAMP']) . " " . " ";
echo "<br />";
echo " ". " ". round ($row['VALUE'], 2);
echo "<br />";
}
?>

New Topic/Question
Reply



MultiQuote





|