var TimeObjectUtil;
/**
* @title 時間工具類別
* @note 本類一律違規驗證回傳false
* @author {boonyachengdu@gmail.com}
* @date 2013-07-01 * @formatter "2013-07-01 00:00:00" , "2013-07-01"
*/
TimeObjectUtil = {
/**
* 取得目前時間毫秒數
*/ return myDate.getTime();
},
/**
* 毫秒轉時間格式
*/
* 時間格式轉毫秒
var myDate = new Date(time);
return this.formatterDateTime(myDate);
},
/** return myDate.getTime();
},
/**
* 格式化日期(無時間)
*/
atetime = date.getFullYear( )
"-"// "年"
(date.getMonth () 1) )
"-"// "月"
.getDate());
回收日期與日期;
},
/**
* 格式化日期(含時間"00:00:00")
*/
formatterDate2 : function(date) {
"-"// "年"
((date.getMonth() 1) > 10? (date.getMonth() 1) : "0"
Month() 1))
"-"// "月"
(date.getDate() },
/**
* 格式化去日期(含時間)
*/
formatterDateTime : function(date) {
"-"// "年"
((date .getMonth() 1) > 10 ? (date.getMonth() 1) : "0"
"-"// "
(日期.get)日期( ) 🎜> (date.getHours() .getHours())
(date.getMinutes() " :"
(date.getSeconds() 返回日期時間;
},
/* *
* 時間比較{結束時間大於開始時間}
*/
compareDateEndTimeGTStartTime : function(startTime, endTime) {
return ((new Date(endTime.replace(/-/g, "/")) > startTime.replace (/-/g, "/"))));
},
🎜> var now = formatterDayAndTime( new Date());
var sms = new Date(startTime.replace(/-/g, "/"));
. g, "/ 」));
var tdayms =月* 30 * 24 * 60 * 60 * 1000;
var dvalue = ems -sms; sms;
if(dvalue> tdayms){
> }
return true;
},
/**
* 驗證開始時間合理性{開始時間不能小於目前時間{X}個月}
*/
> formatterDayAndTime(new Date()) ;
var sms = new Date(now.replace(/-/g, "/"));
var ems = new Date(end.replace(/)/
var tDayms = 月* 30 * 24 * 60 * 60 * 1000;
var return false;
}
return true;
},
/**
* 驗證開始時間合理性{結束時間與開始時間的間隔不能大於{X}個月}
*/
CompareEndTimeGTStartTime : function(month, startTime, endTime) {
ems = new Date(endTime.replace(/-/g, "/"));
var tDayms = 月* 30 * 24 * 60 * 60 * 1000; var daymsTime = day * 24 * 60 * 60 * 1000;
var yester this.longMsTimeConvertToDateTime(yesterDatsmsTime);
var 過去日期 = this.formatterDate2 (new Date(startTime));
var nowDate = this.formatterDate2(new Date());
日期,
endTime : nowDate
};
return obj;
},
var daymsTime = 24 * 60 * 60 * 1000;
varD atsms時間= this.getCurrentMsTime() daymsTime;
var currentTime = this.longMsTimeConvertToDateo( this.longMsTimeConvertToDateTime(tomorrowDatsmsTime);
var nowDate = this.format terdate2(新日期(currentime));
var futuredate = this.formatterdate2(new Date(termoorntime)); var obj = {
> 🎜>},
/**
* 取得最近幾天[開始時間與結束時間值,時間往前推算]
* /
> getTomororyDateTime:function(){
var> var daymstime = 24 * 60 * 60 * 60*60*1000; var termorrowTime = this.longMsTimeConvertToDateTime(DateTime(DateTime); msTime = this.getCurrentMsTime() (2 * 天msTime);
var theDayAfterTomorrowTime = this.longMsTimeCon vertToDateTime(theDayAfterTomorrowDatsmsTime);
var PastDate = this.formatterDate2(new Date(termorrowTime));
esDayofate var nowDate = var obj = {
startTime : PastDate,
🎜> }
};