Jump to content

Date Help !


Recommended Posts

ok... all i'm trying to do is use a funtion to help return the number of days left until an occasion... like christmas for example. now the script works perfectly, but i want to make it easier and wrap it up in a function... but, the function doesn't work... mabye you can help ??

function DaysTill(MONTH,DAY,NAME){today=new Date()var occasion=new Date(today.getFullYear(), MONTH, DAY)if (today.getMonth()>=MONTH && today.getDate()>DAY){occasion.setFullYear(occasion.getFullYear()+1)}var one_day=1000*60*60*24document.write(Math.ceil((occasion.getTime()-today.getTime())/(one_day))+ " days left until " + NAME)}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...