how to compare only date and year in php codeigniter

后端 未结 3 923
闹比i
闹比i 2021-01-06 13:40

My model

public function get_payscale() {
    $this->db->from(\'payscale P\')->join(\'employee E\',\'E.employee_id = P.employee_id \');
    $this-&g         


        
3条回答
  •  一整个雨季
    2021-01-06 14:31

    Use like this :

    $this->db->where('EXTRACT(YEAR_MONTH FROM P.payscale_date)',date('Ym'));
    

    This query will extract the Year and month from the date given column like 201605 (2016-05-21)

提交回复
热议问题