我之前尝试过问这个问题,但我之前遇到了一个问题,就是从HTML表中的输入字段中正确地获取文本日期、月、日和年日期。
现在我已经获得了这个字符串数据,在本例中,“2014年8月25日”,我希望将转换为日期数据,最终将插入到MySQL表中。
PHP:
$todays_date = strtotime("today");
echo "<form name='timesubmit" . $time_cell_row . "' action='enter_time.php?action=timesubmit" .$time_cell_row . "' method='POST'>";
echo "<table>"
echo "<th><input name='daycell1' type='text' value='$FormattedCurrDate' readonly/></th>";
echo "</table>";
echo "</form>";
/* Code in place to GET action from URL
*/
$date1 = $_POST['daycell1'];
echo "Date from input field: " . $date1; // displays "Aug 25, 2014如何将变量'$date1‘转换为日期格式,以便将其插入具有" date“类型字段的MySQL表中?
https://stackoverflow.com/questions/25497499
复制相似问题