/**
* 获取指定时间年的最后一天
* @param now 指定时间 Date 对象
* @return Date 某年的最后一天
*/
ZCPGFFutil.getLastDayInYear = function(now){
var nextyear = now.getFullYear()+1;
var nowLast = new Date(nextyear,0,1) - 1000*60*60*24;
return nowLast;
};
/**
*
* 求一日期到今年最后一天之间间隔的天数
* @return number
*
*/
ZCPGFFutil.getDateNumber = function(date){
var lastDay = ZCPGFFutil.getLastDayInYear(date);
return parseInt(Math.abs(new Date(lastDay)-date)/1000/24/60/60);
}
/**
* 日期格式化
* @return yyyy - mm - dd
*/
Date.prototype.format = function(){
var str = "";
var year = this.getFullYear();
var month = this.getMonth() + 1;
if(month < 10){
month = "0" + month;
}
var day = this.getDate();
if(day < 10){
day = "0" + day;
}
str = year + " - " + month + " - " + day;
return str;
};