Suppose your current month is February or a month that has 30 days
echo date('Y-12-t', strtotime(date('Ym-d'))); // if current month is february (2015-02-01) than it gives 2015-02-28
will give you inaccurate results
Decision:
So, to get the exact result for the end date of the year, try the code below
$start_date = date("Y-01-01", strtotime("-1 year"));// get start date from here $end_date = date("Y-12-t", strtotime($start_date));
(OR)
$last_year_last_month_date = date("Y-12-01", strtotime("-1 year")); $end_date = date("Y-12-t", strtotime($last_year_last_month_date));
source share