可能重复:
如何格式化从数据库接收到的日期和时间
我想只在“In Comming Date”列中显示日期,并且只在“In Comming Time”中显示时间我的代码是任何人都可以帮助我,我是新手
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
or die("Opps some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong");
$sql="SELECT * FROM `hr_inout_time` WHERE user_id='$login_id'";
$result = mysql_query($sql) or die(mysql_error());
echo "<table align='center' border='1' cellspacing='5' width='50%' height='50%'>
<th>In Comming Date</th>
<th>In Comming Time</th>
";
while($row=mysql_fetch_array($result)) {
$in_time=$row["user_in_time"];
$time_date =$row["time_date"];
echo "<tr>
<td align='center'>$time_date</td>
<td align='center'>$in_time</td>
</tr>";
}
echo('</table>');
?>