How to get current month in Codeigniter?

How to get current month in Codeigniter?

tutorials - 5 undefined, 2020

How to get current month in Codeigniter?

In this example, we will learn how to get current month data in codeigniter. we can get current month data using codeigniter query builder. we will use MONTH() and YEAR() mysql function for getting current month data.

I will share with you simple example example of getting current month data in codeigniter 3 application. sometime it might be require to get and display only current month data in your php codeigniter 3 application.

You can see bellow example database query to getting current month data from database items table.


$data['data'] = $this->db->select('*')

->where('MONTH(created_at)', date('m'))

->where('YEAR(created_at)', date('Y'))








[0] => stdClass Object


[id] => 2

[title] => Codeigniter 3 CRUD Example

[description] => Codeigniter 3 CRUD Example From Scratch To follow :

[created_at] => 2019-07-11 00:00:00

[updated_at] => 0000-00-00 00:00:00



Our Sponsors

NodeJS Experts
React Experts
PHP Experts
AngularJS Experts
Aws Experts
Firebase Experts

Top Applications in TutorialStuff

Top Experts In TutorialStuff

Trending On TutorialStuff