<mce:script type="text/javascript"><!-- //http://www.ozzu.com/programming-forum/javascript-dateadd-function-t47986.html function dateAddExtention(p_Interval, p_Number){ var thing = new String(); //in the spirt of VB we'll make this function non-case sensitive //and convert the charcters for the coder. p_Interval = p_Interval.toLowerCase(); if(isNaN(p_Number)){ //Only accpets numbers //throws an error so that the coder can see why he effed up throw "The second parameter must be a number. /n You passed: " + p_Number; return false; } p_Number = new Number(p_Number); switch(p_Interval.toLowerCase()){ case "yyyy": {// year this.setFullYear(this.getFullYear() + p_Number); break; } case "q": { // quarter this.setMonth(this.getMonth() + (p_Number*3)); break; } case "m": { // month this.setMonth(this.getMonth() + p_Number); break; } case "y": // day of year case "d": // day case "w": { // weekday this.setDate(this.getDate() + p_Number); break; } case "ww": { // week of year this.setDate(this.getDate() + (p_Number*7)); break; } case "h": { // hour this.setHours(this.getHours() + p_Number); break; } case "n": { // minute this.setMinutes(this.getMinutes() + p_Number); break; } case "s": { // second this.setSeconds(this.getSeconds() + p_Number); break; } case "ms": { // second this.setMilliseconds(this.getMilliseconds() + p_Number); break; } default: { //throws an error so that the coder can see why he effed up and //a list of elegible letters. throw "The first parameter must be a string from this list: /n" + "yyyy, q, m, y, d, w, ww, h, n, s, or ms. You passed: " + p_Interval; return false; } } return this; } Date.prototype.dateAdd = dateAddExtention; //pay attention to the new. If you don't use it //you won't create a Date object, and that code up there won't work var dToday = new Date(2010, 4, 29); //blamo! alert( dToday.dateAdd("m", -3) ); // --></mce:script>