Yii Framework Forum: Unix Timestamp, Stored, Served With Date But Missing The Stored Timestamp - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Unix Timestamp, Stored, Served With Date But Missing The Stored Timestamp Rate Topic: -----

#1 User is offline   lovelf 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 25-January 13

Posted 26 January 2013 - 05:22 PM

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users