In this tutorial, we will learn how to get current month data in Codeigniter. We can get current month data using the Codeigniter query builder. We will use MONTH() and YEAR() MySQL functions for getting current month data.
Example:
<?php
$data['data'] = $this->db->select('*')
->where('MONTH(created_at)', date('m'))
->where('YEAR(created_at)', date('Y'))
->get("items")
->result();
print_r($data['data']);
exit;
I hope this will help you..