Create last day of month PHP

时间:2015-07-29 00:13:30

标签: php date datetime

I have a form with a date picker which allows the user to select only the month and year. Upon submitting the form The value it gets from the form is:

v <- rep(FALSE, 1e6)
v[5e5-1] <- TRUE
v[5e5+1] <- TRUE
library(microbenchmark)
microbenchmark(rangeWhich(v), shortCircuit(v))
# Unit: microseconds
#             expr       min         lq    median        uq       max neval
#    rangeWhich(v)   751.252   884.8805  1109.527  1115.995  1163.135   100
#  shortCircuit(v) 60712.586 61004.2760 61396.715 61994.517 72382.216   100

I need to use this to create 2 dates. I need the 1st of July and the 31st of July. I can create the 1st no problems using:

$the_Date = $_POST['month_Year'];
echo 'month date: '.$the_Date.'<br />';
// echos 'month date: July 2015' in this example

But I don't know how to create the $last_Of_Month seeing as not all months end on the 31st. Any help would be greatly appreciated

1 个答案:

答案 0 :(得分:1)

When using document.querySelector("button").addEventListener("click", function() { html2canvas(document.querySelector("#elem"), { canvas: canVar, width: widthVar, height: heightVar, background: undefined, letterRendering: true, useCORS: true }).then(function(canvas) { console.log('Drew on the existing canvas'); }); }, false); , the value date() returns the number of days in the month.

You can run t