วันที่ JavaScript ตามรูปแบบการจัดรูปแบบ -
| ประเภทวันที่ | Format |
|---|---|
| วันที่ ISO | "2017-11-29" (มาตรฐานสากล) |
| Short Date | "11/29/2017" |
| Long Date | "29 พ.ย. 2560" |
| วันที่เต็ม | "วันพุธที่ 29 พฤศจิกายน 2017" |
ตัวอย่าง
นี่คือวิธีแสดงวันที่ปัจจุบัน -
การสาธิตสด
<!DOCTYPE html>
<html>
<body>
<p>Click below to get the current date:</p>
<button onclick="display()">Display Date</button>
<p id="test"></p>
<script>
function display() {
var date = new Date();
document.getElementById("test").innerHTML = date;
}
</script>
</body>
</html>