无涯教程-getUTCMonth()函数

46 阅读1分钟

JavaScript date getUTCMonth()方法根据通用时间返回指定日期中的月份。 getUTCMonth返回的值是0到11之间的整数,对应于月份。 1月为0,2月为1,3月为2,依此类推。

语法

Date.getUTCMonth ()     

返回值

根据世界时间返回指定日期中的月份。

Example

var dt=new Date( "December 25, 1995 23:15:20" ); 
console.log("getUTCMonth() : " + dt.getUTCMonth() );   

输出

getUTCMonth() : 11    

参考链接

www.learnfk.com/es6/es6-get…