我无法在数据库中存储日期值,如果它的字符串,我怎样才能将其转换为日期格式?
<div class='input-group date' id='datetimepicker1'>
<input type='text' id="startDate" data-bind="value: startDate()" class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
<span class="input-group-addon">
<span onclick="startToday()">Today</span>
</span>
</div>
答案 0 :(得分:0)
正确的方法是使用http://www.mapquestapi.com/geocoding/v1/address?key=your_key_here&location=Easton,PA&outFormat=xml&maxResults=1
并使用JavaScript Date Object
<input type="date">
&#13;
function parse() {
var startDate = document.getElementById("startDate").value.split("-");
var date;
if (startDate.length == 3) date = new Date(startDate[0], startDate[1], startDate[2]);
else date = new Date();
console.log("Formated:", date);
console.log("Timestamp:", date.valueOf() / 1000);
}
&#13;