Home > Web Front-end > JS Tutorial > Analysis of the method of obtaining year, month, day, hour, minute and second using JS

Analysis of the method of obtaining year, month, day, hour, minute and second using JS

高洛峰
Release: 2016-12-03 16:50:18
Original
1527 people have browsed it

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();
Copy after login

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();
Copy after login

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();
Copy after login


Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template