使用 getfullyear() 获取年份。
源代码:
click the button to display the full year of todays date.
try it
测试结果:
2015
gettime()
gettime() 返回从 1970 年 1 月 1 日至今的毫秒数。
源代码:
click the button to display the number of milliseconds since midnight, january 1, 1970.
try it
测试结果:
1445669203860
setfullyear()
如何使用 setfullyear() 设置具体的日期。
源代码:
click the button to display a date after changing the year, month, and day.
try itremember that javascript counts months from 0 to 11.month 10 is november.
测试结果:
tue nov 03 2020 14:47:46 gmt+0800 (中国标准时间)
toutcstring()
如何使用 toutcstring() 将当日的日期(根据 utc)转换为字符串。
源代码:
click the button to display the utc date and time as a string.
try it
测试结果:
sat, 24 oct 2015 06:49:05 gmt
getday()
如何使用 getday() 和数组来显示星期,而不仅仅是数字。
源代码:
click the button to display todays day of the week.
try it
测试结果:
saturday
display a clock
如何在网页上显示一个钟表。
源代码:
