Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1512 How can I countdown to the 17th of May - when I graduate?

You are here: irt.org | FAQ | JavaScript | Date | Q1512 [ previous next ]

Try:

<script language="JavaScript"><!--
now = new Date();
// 4th javascript month is May
future = new Date(2000,04,17,now.getHours(),now.getMinutes(),now.getSeconds());
aDay = 24*60*60*1000;
days = 0;
for (i=now.getTime(),n=future.getTime();i<n;i=i+aDay) {
   aDate = new Date(i);
   weekDay = aDate.getDay();
   if (weekDay != 6 && weekDay != 0) days++;
}
if (days>0) document.write(days +' left to graduation');
else if (days==0) document.write('Graduation today!!!');
else document.write('Well, did you graduate?');
//--></script>

Feedback on 'Q1512 How can I countdown to the 17th of May - when I graduate?'

©2018 Martin Webb