JavaScript Date.getMonth()方法根据本地时间返回指定日期的月份。getMonth()返回的值是一个介于0和11之间的整数。0对应于1月,1到2月,依此类推。
Date.getMonth()
根据本地时间返回指定日期的月份。
链接:https://www.learnfk.comhttps://www.learnfk.com/javascript/date-getmonth.html
来源:LearnFk无涯教程网
<html> <head> <title>JavaScript getMonth Method</title> </head> <body> <script type="text/javascript"> var dt=new Date( "December 25, 1995 23:15:00" ); document.write("getMonth() : " + dt.getMonth() ); </script> </body> </html>
运行上面代码输出
getMonth() : 11
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)