JavaScript如何打印年月日时分秒在页面上
1、新建一个test.html文件,用于讲解JavaScript如何打印年月日时分秒在页面上。

3、在js标签内,使用getFullYear(),getMonth(),getDate()方法分别获得年月日的时间。

5、在js标签内,将上面获得的时间拼装成年月日时分秒的格式,使用write()方法打印在页面上。

1、新建一个test.html文件,用于讲解JavaScript如何打印年月日时分秒在页面上。
3、在js标签内,使用getFullYear(),getMonth(),getDate()方法分别获得年月日的时间。
5、在js标签内,将上面获得的时间拼装成年月日时分秒的格式,使用write()方法打印在页面上。