This topic is locked
[SOLVED]

 Display date as MM/DD/YYYY

6/10/2017 5:46:32 PM
PHPRunner General questions
M
mhollibush author

Need assistance with the date format of this query

How can I get the date to display in US Format?
global $pageObject;

$data = $pageObject->getCurrentRecord();

$sql = "SELECT * FROM

cases where company =".$data["companyId"]." ";

$rscases = CustomQuery($sql);
echo "<table width='80%' border='1' bordercolor='#C0C0C0' cellpadding='5' >";

echo "<tr>";

echo "<td>&nbsp;&nbsp;Case</td>";

echo "<td>&nbsp;&nbsp;Date</td>";

echo "<td>&nbsp;&nbsp;Start Time</td>";

echo "<td>&nbsp;&nbsp;End Time</td>";

echo "<td>&nbsp;&nbsp;Repair Type</td>";

echo "</tr>";

while($data1=db_fetch_array($rscases))
{

echo "<tr><td>&nbsp;&nbsp;<a href=cases_view.php?editid1=".$data1["caseId"].

">". $data1["case"]."</a></td>";
echo "<td>&nbsp;&nbsp;". $data1["date"]."</td>";// NEED THIS TO DISPLAY MM/DD/YYYY
echo "<td>&nbsp;&nbsp;". $data1["time"]."</td>";

echo "<td>&nbsp;&nbsp;". $data1["end_time"]."</td>";

echo "<td>&nbsp;&nbsp;". $data1["repairtype"]."</td></tr>";
}

echo "</table>";

M
mhollibush author 6/10/2017

Figured it out.
echo "<td>&nbsp;&nbsp;";

$data1["date"] = date("l M-d-Y ", strtotime($data1["date"]));

echo "". $data1["date"]."</td>";