日期对象用于处理日期和时间。
创建 Date 对象:Data d=new Date();
可用方法及注意事项
getYear():获取年份。注:若要返回真实年份,需要让返回值+1900
getMonth():返回月份。注:若要返回真实月份,需要让返回值+1
getDate():返回当前月份第几日
getHours(),getMinutes(),getSeconds():返回小时,分钟,秒钟
getTime():获取毫秒值
日期对象用于处理日期和时间。
创建 Date 对象:Data d=new Date();
可用方法及注意事项
getYear():获取年份。注:若要返回真实年份,需要让返回值+1900
getMonth():返回月份。注:若要返回真实月份,需要让返回值+1
getDate():返回当前月份第几日
getHours(),getMinutes(),getSeconds():返回小时,分钟,秒钟
getTime():获取毫秒值