Hi, I’m storing the timestamp as a UNIX timestamp, then I use this on the model:
protected function afterFind ()
{
// convert to display format
$this->creation_timeu = $this->creation_time;
$this->creation_time = date ('m/d/Y h:i a', $this->creation_time);
parent::afterFind ();
}
what it does is when calling for creation time from everywhere it gets formatted with the date format, now I would like
to be able to call creation_timeu as well, but do not know how, the following error pops when doing $data->creation_timeu
It is not on the database, it seems I’m trying to declare it as an extra field that is outside the database but it does not
get declared from the lines above.
Property "News.creation_timeu" is not defined.
error is marked here:
public function __set($name,$value)
{
if($this->setAttribute($name,$value)===false)
{
if(isset($this->getMetaData()->relations[$name]))
$this->_related[$name]=$value;
else
parent::__set($name,$value);
}
}
on yiiroot\framework\db\ar\CActiveRecord.php(159)
I’d like to be able to call creation_timeu as with afterFind I’m setting it up in there as the original value of creation_time before turning it as a date format.
Thanks.
I was missing public $creation_timeu on the class, fixed it