Home > Article > Web Front-end > Analysis of the method of obtaining year, month, day, hour, minute and second using JS
The example of this article analyzes the JS method of obtaining the year, month, day, hour, minute and second. Sharing it with everyone for your reference, the details are as follows:
var d = new Date(); var time = d.getFullYear() + "-" +(d.getMonth()+1) + "-" + d.getDate() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
It has to be so complicated, there is no way.
I thought jQuery would be able to streamline functions, but found that it wasn’t.
You can only use this primitive writing method to get the information of year, month, day, hour, minute and second.
tips:
JS cannot have spaces when passing parameters, otherwise the data will not be obtained.
url="send.php?action=record_info&order_id=" + $("#order_id").val() + "&remark = "+$('#remark').val();
There are spaces before and after the equal sign after the remark parameter above, resulting in no data being obtained.
Correct writing:
url="send.php?action=record_info&order_id=" + $("#order_id").val() + "&remark="+$('#remark').val();