/*
* 함수 이름: DateUtil
* 작성자 : yithcn
* 함수 설명: 날짜 함수
* 사용 방법:
* 생성 날짜: 2010.10.14
*/
var DateUtil =
DateUtil; .base = 60 * 60 * 24 * 1000;
DateUtil.Add = function(num, sDate) {
num = num || 0; >var base = this.base * num;
var todayMs = sDate.getTime();
todayMs = base;
sDate.setTime(todayMs); ) 1); m var d = sDate.getDate();
var y = sDate.getFullYear();
return m "/" d "/" y
};
DateUtil.Diff = function(sDate, eDate, mode) {
if (typeof sDate == "string")
sDate = new Date(sDate);
if (typeof eDate == "string")
eDate = new Date(eDate)
sDate = sDate || new Date();
eDate || new Date();
try {
sDate.getYear()
} catch(e) {
);
}
var result = Math.abs(eDate - sDate)
스위치(모드) {
case "y":
result /= this.base * 365; 🎜>break;
case "m":
result /= this.base * 365 / 12
break
case "w":
result /= this.base * 7 ;
break;
기본값:
result /= this.base;
break
}
return(Math.floor(result))
DateUtil.Time = function(hasSec) {
var date = new Date();
return date.getHours() ":" date.getMinutes() (hasSec ? ":" date.getSeconds() : "");
DateUtil.TimeSplit = function(hasSec) {
var date = new Date()
return { 시: date.getHours(), 분: date.getMinutes (), 두 번째 : (hasSec ? ":" date.getSeconds() : "") }