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

Feedback: irt.org FAQ Knowledge Base Q533

Feedback on: irt.org FAQ Knowledge Base Q533

Sent by michel on July 31, 2001 at 14:47:20: - feedback #3029

Comments:
Here is an example on how to use the script

<form>
<script>
function days_in_month (year, month) {
return 32 - new Date(year, month, 32).getDate();
}
now = new Date();
daysInMonth = days_in_month(now.getFullYear(),now.getMonth());
txt='<select name="days">';
for (i=1;i<=daysInMonth;i++) txt += '

Sent by Jeff Boulton on September 05, 2001 at 10:41:18: - feedback #3128

Worth:
Very worth reading

Comments:
Very cool. But unless I am missing something the day number is zero based. ie: February is "1"

THANX


Sent by W on September 29, 2002 at 20:07:38: - feedback #4177

Worth:
Not worth reading

Length:
Too short

Comments:
Hey!What value does newdate have?! Are the variables being multiplied by newdate then added together or are they being manipulated on some other way?! What language is this written in?! What is the point in posting this without any type of explanation. Does the individual who posted this think everyone has the same knowledge as they? Or is it if they don't already know then they have no business looking here anyway?! If this is a fair sample of your database I propose that it must be a usless waste of storage space!!!!!!!!


Sent by Pankaj Jain on November 13, 2002 at 14:28:25: - feedback #4265

Technical:
Not technical enough

Comments:
It is a clever peice of code, but it looks like it is using a so called BUG in the Date() object. Ideally if you pass day as 32 it should give you error. Think when this bug is fixed and your program will stop working; you will have tough time finding this error.


Sent by Giacomo on Tuesday July 10, 2007 at 00:12:03 - feedback #4793

Worth:
Very worth reading

Length:
Just right

Technical:
Just right

Comments:
Why not try
var date = new Date();
date.setMonth(2,0);
var numberOfDaysInJanuary = date.getDate();




Sent by Daniel Ansari on Friday November 23, 2007 at 01:32:57 - feedback #5156

Worth:
Worth reading

Length:
Just right

Technical:
Just right

Comments:
Here's a safer method:

function daysInMonth(dt) {
var endNextMonth = new Date(dt);
endNextMonth.setDate(1);
endNextMonth.setMonth(dt.getMonth() + 1);
endNextMonth.setDate(0);
var daysInEndMonth = endNextMonth.getDate();
return daysInEndMonth;
}





Sent by Avinash on Sunday February 24, 2008 at 20:17:48 - feedback #5219

Worth:
Very worth reading

Length:
Just right

Technical:
Just right

Comments:
Excellent, short and precise




©2018 Martin Webb