0

I need to get users which their payment_time is between startDate and endDate in cakePHP.dates are in jalali format :

۱۳۹۷ - ۰۱ - ۱۴

and my controller is as follows:

public function search(){

    if ($this->request->is('post')){
        if(!empty($this->request->data['User']['start_date'])&&
           !empty($this->request->data['User']['end_date'])){

           $start_date =  $this->request->data['User']['start_date'] ;
           $end_date = $this->request->data['User']['end_date'];
           $this->Paginator->settings['conditions']['AND'] = array(
                                      'User.payment_time >= ' => $start_date,
                                      'User.payment_time <= ' => $end_date);

           $this->set('users', $this->Paginator->paginate());
        }
}

But users is view page is null. Is this method can help for jalali dates?

sahar
  • 117
  • 3
  • 15

1 Answers1

1

Simply make a snippet to replace the Urdu/English numerals with English/Urdu numerals then parse the dates.

  • Do you mean I save English numbers in database and change them to persian numbers only for show in views? – sahar May 02 '18 at 07:49