Get the first and last day of the month
var New Date (); Firstdate // First day var New Date (firstdate); EndDate. Setmonth (Firstdate.getmonth () +1); EndDate. SetDate (0);
Alert ("First day:" +firstdate.format (' yyyy-mm-dd 00:00:00 ') + "Last Day:" +enddate.format (' Yyyy-mm-dd 23:59:59 '));
//Time FormattingDate. Prototype.format =function(format) {varo = { "m+": This.getmonth () + 1,//Month"D+": this.getDate(),// Day"H +": this.gethours (),//Hour"m+": this.getminutes (),//minute"S+": This.getseconds (),//Second"q+": Math. Floor((This.getmonth () + 3)/3),//Quarter"S": This.getmilliseconds ()//Millisecond } if(/(y+)/.Test (format)) {Format= Format.replace (Regexp.$1, (this.getfullyear () + "").substr(4-regexp.$1.length)); } for(vark in O) { if(NewRegExp ("(" + K + ")").Test (format)) {Format= Format.replace (regexp.$1, regexp.$1.length = = 1? O[k]: ("XX" + o[k]).substr(("" + o[k]).length)); } } returnformat;}
PHP-Side processing
$startdate=strtotime($data[' startdate ']); // String Turn timestamp Echo Date ("Y-m-d h:i:s",$startdate); // 24 Hours Echo Date ("Y-m-d h:i:s",$startdate); // 12 Hours
Get the first and last day of the month