1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>标准对象-Date</title> </head> <body>
<script> var d=new Date(); console.log(d);
var stamp=new Date().getTime(); console.log(stamp);
var d1=new Date("Mon Apr 27 2020 13:45:29 GMT+0800"); console.log(d1.toLocaleString()); console.log(d1.toUTCString());
var d2=new Date(2020,4,17,14,10,26,120); console.log(d2); console.log(d2.getFullYear()); console.log(d2.getMonth()); console.log(d2.getDay()); console.log(d2.getHours()); console.log(d2.getMinutes()); console.log(d2.getSeconds()); console.log(d2.getMilliseconds());
</script> </body> </html>
|