Forum Moderators: open
I'm using a javascript calendar from a tutorial website, which is great and works really well.
I've successfully altered it to do exactly what I want, but I've become stuck.
It has this code:
cal18.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));
which calls a function:
function formatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate(); ---- and it goes on and on
cal18.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"),1);
...
function formatDate(date,format,days)
...
d=date.getDate()+parseInt(days);
Can anyone advise me further? Will I be able to call a javascript function to change this dynamically too?
Thanks for reading, and please help if you can!
<script type="text/javascript">
var date = new Date();
document.write(date + "<br>");
var date = new Date(new Date().getTime() + 86400000);
document.write(date);
</script>
Date.prototype.addDay= function(n,boo){
if(!n) n= 1;
n*=(86400000);
var x= (this.getTime()+n);
x= new Date(x);
if(boo)x= x.toUTCString();
return x;
}
d is a second date
n is a number of days-if n is 7 it returns weeks
Date.prototype.daysFrom= function(d,n){
if(!d) d= new Date();
if(!n) n=1;
var x= this.getTime()- d.getTime();
var y= n*(86400000);
return Math.round(x/y);
};