Esempio n. 1
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->created = new CDbExpression('NOW()');
     } else {
         $this->modified = new CDbExpression('NOW()');
     }
     return parent::beforeSave();
 }
Esempio n. 2
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->created = new CDbExpression('NOW()');
     } else {
         $this->modified = new CDbExpression('NOW()');
     }
     if ($this->isNewRecord) {
         $this->dateDBformat = false;
     }
     if (!$this->dateDBformat) {
         $this->dateDBformat = true;
         $this->src_date = date("Y-m-d H:i:s", CDateTimeParser::parse($this->src_date, Yii::app()->locale->getDateFormat('yiishort')));
     }
     return parent::beforeSave();
 }
Esempio n. 3
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->dateDBformat = false;
     }
     if ($this->reg_date == null) {
         $this->reg_date = date(Yii::app()->locale->getDateFormat('phpdatetimes'));
     }
     //echo Yii::app()->locale->getDateFormat('yiishort');
     //echo $this->due_date;
     //echo CDateTimeParser::parse($this->due_date,Yii::app()->locale->getDateFormat('yiishort'));
     //echo date("Y-m-d H:m:s",CDateTimeParser::parse($this->due_date,Yii::app()->locale->getDateFormat('yiishort')));
     //echo $this->due_date.";".$this->issue_date.";".$this->modified."<br>";
     if (!$this->dateDBformat) {
         $this->dateDBformat = true;
         $this->due_date = date("Y-m-d H:i:s", CDateTimeParser::parse($this->due_date, Yii::app()->locale->getDateFormat('yiidatetime')));
         $this->issue_date = date("Y-m-d H:i:s", CDateTimeParser::parse($this->issue_date, Yii::app()->locale->getDateFormat('yiidatetime')));
         $this->reg_date = date("Y-m-d H:i:s", CDateTimeParser::parse($this->reg_date, Yii::app()->locale->getDateFormat('yiidatetime')));
         $this->ref_date = date("Y-m-d H:i:s", CDateTimeParser::parse($this->ref_date, Yii::app()->locale->getDateFormat('yiidatetime')));
     }
     //return true;
     //echo $this->due_date.";".$this->issue_date.";".$this->modified;
     //Yii::app()->end();
     return parent::beforeSave();
 }