js内置对象的常用方法

Date对象:

设置日期:

new Date("month dd,yyyy hh:mm:ss");
new Date("month dd,yyyy");
new Date(yyyy,mth,dd,hh,mm,ss);
new Date(yyyy,mth,dd);
new Date(ms);

创建日期对象--------------new Date();

一个月的某一天 ----------getDate()     1-31

一周的某一天--------------getDay()      0-6    实际日期要加1

一年的某个月--------------getMonth()   0-11  实际日期要加1

小时数------------------------getHours()

分钟----------------------------getMinutes()

秒--------------------------------getSeconds()

获取原始值--------------------------valueOf()

扫描二维码关注公众号,回复: 6866916 查看本文章

设置原始值---------------------------getTime()

猜你喜欢

转载自www.cnblogs.com/cui-ting/p/11245937.html