This is a discussion on Calculate how many hours per each month within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... Can anyone tell me how can i calculate how many hours per each month. Thanks......
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all... <SCRIPT LANGUAGE="JavaScript"><!-- function makeArray() { this[0] = makeArray.arguments.length; for (i = 0; i<makeArray.arguments.length; i++) this[i+1] = makeArray.arguments[i]; } var months = new makeArray('Jan','Feb','Mar','Apr','May','Jun','Jul ','Aug','Sep','Oct','Nov','Dec'); var days_per_month = new makeArray(31,28,31,30,31,30,31,31,30,31,30,31); function LeapYear(year) { if ((year/4) != Math.floor(year/4)) return false; if ((year/100) != Math.floor(year/100)) return true; if ((year/400) != Math.floor(year/400)) return false; return true; } function y2k(number) { return (number < 1000) ? number + 1900 : number; } var myDate = new Date(1999,0,1); // 1st January 1999 if (LeapYear(y2k(myDate.getYear()))) days_per_month[2] = 29; else days_per_month[2] = 28; for (var month = 1; month<12+1; month++) { document.write(months[month] + ' ' + (days_per_month[month]*24) + ' hours<BR>'); } //--></SCRIPT> Thanks... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/html-css-javascript-coding-techniques/5338-calculate-how-many-hours-per-each-month.html | |||
| Posted By | For | Type | Date |
| DiscussWeb IT Community - Technical Support and Technology Discussions | This thread | Refback | 02-25-2008 11:24 PM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Number of days in a month (or last day of a month) | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 04-28-2008 08:47 PM |
| Find the last day of the month for any given month. | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 03-17-2008 08:56 PM |
| calculate the number of days in the current month | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 02-08-2008 06:30 AM |
| How do i subtract a hours from a date? | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 12-20-2007 06:19 AM |
| How many hours do you spend online? | googoo | The Lounge | 18 | 03-23-2007 10:44 PM |