時間的相加減:java
在java中能夠有這樣的:數據庫
Date.prototype.addDays = Date.prototype.addDays || function(days){
this.setDate(this.getDate() + days);
return this;
}ide
//Date.prototype.addDays = Date.prototype.addDays || function(days) 防止addDays函數已經在其它地方定義了,函數
alert("after 3 days:"+new Date().addDays(3));
alert("before 3 days:"+new Date().addDays(-3));this
還能夠直接用calendar.data+一個數據;prototype
同時在數據庫中也能夠這樣:get
數據庫中有函數:it
在數據庫中datediff(d,'date1','date2')是兩個時間相減(date2-date1);io
在C#中能夠把時間轉化成時間戳,而後進行相加減。function
Js 中var today=new Date(); // 獲取今天時間 today.setDate(today.getDate() + 7);