获取当天日期
程序员文章站
2024-01-06 08:09:34
...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--需网上下载/jquery-2.2.4.js-->
<script src="js/jquery-2.2.4.js"></script>
<title>当天日期</title>
</head>
<body>
今日:<input type="text" name="alertDateQuery" id="Date">
</body>
<script type="text/javascript">
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
if(month < 10) {
month = "0" + month;
}
if(day < 10) {
day = "0" + day;
}
$("#Date").val(year + "年 -" +month + "月 -" +day + "日");
</script>
</html>