PHP
Codeigniter
How To Get Current Month In Codeigniter?
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.
- 4.5/5.0
- Last updated 05 September, 2022
- By Admin
You can see bellow example database query to getting current month data from database items table.
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; ?>
Output:
Array ( [0] => stdClass Object ( [id] => 2 [title] => Codeigniter 3 CRUD Example [description] => Codeigniter 3 CRUD Example From Scratch To follow : codewale.com [created_at] => 2019-07-11 00:00:00 [updated_at] => 0000-00-00 00:00:00 ) )
I hope it can help you...
Categories
PHP
(5)
Codeigniter
(5)
Laravel
(3)
JS
(1)
Angular JS
(5)
Node JS
(5)
Vue JS
(4)
React JS
(6)
jQuery
(5)
Javascript
(3)
jQuery UI
(6)
Wordpress
(1)
Python
(5)
Database
(1)
MySql
(5)
Mongo DB
(1)
DBMS
(1)
SQL
(5)
HTML
(1)
HTML 5
(5)
CSS
(5)
Bootstrap
(5)
Ajax
(5)
JAVA
(1)
JSON
(5)
Ubuntu
(5)
Server
(5)
Git
(3)
Google
(1)
Google Map
(7)
Google API
(1)
Elastic Search
(1)
Apache
(1)
Installation
(1)