I am trying to convert a unix time stam in php but I am getting errors. I've done lots of research but non works. I keep on getting output 12/31/1969
time stamp from sql = 1396483200
my php is
$q=mysql_query("SELECT * FROM schedule WHERE ID='$id' LIMIT 1");
$q=mysql_fetch_array($q);
$a_sdate=$q['SCHEDULE_DATE'];
$a_sdate=date("m/d/Y", strtotime($a_sdate));
can anyone tell me what I am doing wrong?
If you already got the unix timestamp from the database, then you don't need to use strtotime
:
$a_sdate=date('m/d/Y', $a_sdate);