JavaScript – Date getMonth() 方法
描述
JavaScript date getMonth() 方法返回指定日期的月份,根据本地时间。由 getMonth() 返回的值是 0 到 11 之间的整数。0 对应于一月,1 对应于二月,依此类推。
语法
语法如下:
返回值
返回指定日期的月份,根据本地时间。
例子
请尝试以下示例。
JavaScript date getMonth() 方法返回指定日期的月份,根据本地时间。由 getMonth() 返回的值是 0 到 11 之间的整数。0 对应于一月,1 对应于二月,依此类推。
语法如下:
返回指定日期的月份,根据本地时间。
请尝试以下示例。