1
我有這樣的代碼,將顯示在2017年插入時間從MySQL到日期的錶行
<?php
$month = "03";
$year = "2017";
$start_date = "01-".$month."-".$year;
$start_time = strtotime($start_date);
$end_time = strtotime("+1 month", $start_time);
echo "<table border='1'>";
for($i=$start_time; $i<$end_time; $i+=86400)
{
$list = date('Y-m-d-D', $i);
echo "<tr><td>";
echo $list;
echo "</td><td>** time here ** </td></tr>";
}
echo "</table>";
?>
三月份的所有日期,如果我有日期字段在MySQL中使用此格式如下
3/1/2017 6:32:12 AM
3/12/2017 1:31:41 PM
3/13/2017 2:30:12 PM
3/17/2017 5:33:21 PM
3/19/2017 6:32:54 PM
3/16/2017 7:22:11 PM
3/21/2017 10:12:41 PM
我如何在表中插入以上的時間在每一個它的相應的日期以上
*「如果我有以下格式的MySQL的日期字段」* - 這不是一個好主意。您應該使用MySQL的內置日期時間功能。你稍後會遇到麻煩,*相信我*。 –
是的謝謝你..我會稍後改變.. – sabahan