Get the last day of the month use javascript in VS2008
I have a function which returns the last day of a month. The function is like this:
In Javascript Editor, it works like the above picture.
But in VS2008, it's strange.
I am very strange for this, then I Bing,
http://www.w3schools.com/jsref/jsref_parseInt.asp
See the fuction parseInt(string, radix)
String: the value you want to convert to number.
Rules:
If the string begins with "0x", the radix is 16 (hexadecimal)
If the string begins with "0", the radix is 8 (octal). This feature is deprecated
If the string begins with any other value, the radix is 10 (decimal)
Then, I change my codes
var month = parseInt(strs[1]);
to
var month = parseInt(strs[1],10);
It functions.
Javascript Editor seems not function well.
====================================================================
The JS codes have something wrong. I change it to this:
var strs = p_InputMonth.split("/");
var year = parseInt(strs[0]);
var month = parseInt(strs[1], 10);
var date = new Date(year,month, 0 ); 0: the last day of the month. (Month Index: 0...11)
var lastDay = date.getDate();
When i use new Date(2009,9,iDay) or Date.setDate(iDay) in Javascript Editor, if iDay is not in (1...31) , it will pop an error message "It's a not valid parameter."
but in IE, the js codes work well.
====================================================================
date.setFullYear(year, month+1,1);
date = new Date(date/86400000);
var lastDay =date.getDate();
In Javascript Editor, i must use "/", but in IE i should use "-"
====================================================================
Why Javascript Editor is different with IE? is it just because my JS Editor is free version???