Possible Duplicate:
Calculate last day of month in JavaScript
What is the best way to determine the number of days in a month with JavaScript?
As title says, I'm stuck on finding a way to get the first and last date of the current month with JavaScript or jQuery, and format it as:
For example, for November it should be :
var firstdate = '11/01/2012';
var lastdate = '11/30/2012';
I fixed it with
Datejs
This is alerting the first day:
This is for the last day:
Very simple, no library required:
or you might prefer:
EDIT
Some browsers will treat two digit years as being in the 20th century, so that:
gives 1 January, 1914. To avoid that, create a Date then set its values using setFullYear: