Merkaba_81 Posted October 12, 2006 Share Posted October 12, 2006 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 More sharing options...
aspnetguy Posted October 12, 2006 Share Posted October 12, 2006 what about the function doesn't work? What errors do you get? Link to comment Share on other sites More sharing options...
Merkaba_81 Posted October 12, 2006 Author Share Posted October 12, 2006 what about the function doesn't work? What errors do you get?Well... i think i got it. i guess i just wasn't using quotes at all yesturdayDaysTill(11,25,"Christmas!")this works just fine today... i guess i was just sleepy. anyways Thanks for the help aspnetguy! Link to comment Share on other sites More sharing options...
Guest cfican Posted October 12, 2006 Share Posted October 12, 2006 Your date problem helped me find a solution to my date problem. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now