-2
我需要存储从角度js前端输入的HH:MM AM/PM格式的时间。如何在AM/PM中将用户输入的时间存储在mysql中
HTML
<input type="time" ng-model="booktime">
控制器
$http.post("url", {
'booktime':booktime,
.then(function(response) {
},function(error) {
alert("");
console.error(error);
});
}
Mysql的
$sql = "INSERT INTO table(booktime)
VALUES (TIME_FORMAT('11:00:00', '%h:%i:%s %p'))";
不要存储am/pm,请在检索它时在应用程序中格式化时间。 – Shadow
MySQL DATETIME和TIME数据类型只支持24个时钟,您需要应用程序来处理am/pm .. –
请提供一些示例 – user3698911