$first_day = date('Y-m-01'); $last_day = date('Y-m-t');
date('Y-m-01', strtotime('last month'));
date('Y-m-t', strtotime('last month'));
<?php
// First day of this month
$d = new DateTime('first day of this month');
echo $d->format('jS, F Y');
?>
//get first day of the current month
$start = date("Y-m-1 00:00:00");
//get current date of the month
$end = date("Y-m-d H:i:s");
//query data for the current month so far
$query = $this->db_model->run_query("select column_1, column_2 from table where date_column BETWEEN '".$start."' AND '".$end."'");
$first = date('Y-m-01', strtotime('last month'));
$last = date('Y-m-t', strtotime('last month'));
$config_month = 1;
$config_day = 1;
$new_expiry_date = date('Y-m-d', mktime(0, 0, 0, date('m') + $config_month, 1 + $config_day, date('Y')));
$firstOfMonth = date('Y-m-01');