title: Yii CJuiDatePicker different date formats
body: <p>So I want to show the date in the selection field in a search as dd/mm/yy but my db is set for yy-mm-dd so i want it to be converted for the db use but still show dd/mm/yy for the user in the selection field.</p>
  
  <p>Model:</p>
  
  <pre><code>public function search($auditCriteria=null)
  {
      // Warning: Please modify the following code to remove attributes that
      // should not be searched.
  
      $criteria=new CDbCriteria;
              $cni = new ContractNoteItem();
  
              $criteria-&gt;with =array('contractNoteItems'=&gt;array('select'=&gt;'{{contractNoteItems}}.*','joinType'=&gt;'LEFT OUTER JOIN', ), );
  
  
              if(isset($_GET['cni_client_account_no']) &amp;&amp; $_GET['cni_client_account_no']!=0 &amp;&amp; $_GET['cni_client_account_no']!=""){
                //  echo 2;
                  if(isset($_GET['cni_portfolio_id2']) &amp;&amp; $_GET['cni_portfolio_id2']!=0 &amp;&amp; $_GET['cni_portfolio_id2']!="")
                  {
               //      echo 3;
                      $criteria-&gt;join = 'RIGHT JOIN ial_contract_note_item ON ial_contract_note_item.cni_contract_note_id=t.id';
                      $criteria-&gt;condition = 'ial_contract_note_item.cni_contract_note_id=t.id';
                      $criteria-&gt;compare('cni_contract_note_id',$this-&gt;id);
                      $criteria-&gt;compare('ial_contract_note_item.cni_portfolio_id',$_GET['cni_portfolio_id2']);
                  }else{
                 //     echo 4;
                      $criteria-&gt;join = 'RIGHT JOIN ial_contract_note_item ON ial_contract_note_item.cni_contract_note_id=t.id';
                      $criteria-&gt;condition = 'ial_contract_note_item.cni_contract_note_id=t.id';
                      $criteria-&gt;compare('cni_contract_note_id',$this-&gt;id);
                      $criteria-&gt;compare('ial_contract_note_item.cni_client_account_no',$_GET['cni_client_account_no']);
                  }
               //   echo 5;
              }
             // echo 6, 
  
      $criteria-&gt;compare('id',$this-&gt;id,true);
      $criteria-&gt;compare('cn_fund_house_id',$this-&gt;cn_fund_house_id,true);
      $criteria-&gt;compare('cn_investment_date',$this-&gt;cn_investment_date,true);
      $criteria-&gt;compare('cn_settlement_date',$this-&gt;cn_settlement_date,true);
              $criteria-&gt;compare('transaction_id',$this-&gt;transaction_id,true);
              $criteria-&gt;compare('sub_transaction_id',$this-&gt;sub_transaction_id,true);
              $criteria-&gt;compare('counter_party_trans_ref',$this-&gt;counter_party_trans_ref,true);
              $criteria-&gt;compare('t.modified_by',$this-&gt;modified_by,true);
            //  $criteria-&gt;compare('ial_contract_note_item.cni_portfolio_id',$this-&gt;cni_portfolio_id,true);
  
  
              if($auditCriteria != null &amp;&amp; $auditCriteria)
              {
                  //$criteria-&gt;compare('actual',1);
                  $criteria-&gt;compare('t.pending',1);
              }
  
              if(!$auditCriteria)
              {               
                  $criteria-&gt;compare('t.actual',1);
                  $criteria-&gt;compare('t.pending',0);
              }
  
      return new CActiveDataProvider($this, array(
          'criteria'=&gt;$criteria,
      ));
  }
  </code></pre>
  
  <p>So how exactly should I proceed with this? I tried the altFormat with the altField but it completely overwrites the date format and the db doesn't recognize the actual dateFormat.I know It has to be something with the before and after functions but it seems they don't get loaded</p>