[SOLVED] Rendered date is wrong

I have these functions:

public function getDateStarted()


  return date('m-d-Y', CDateTimeParser::parse($this->DateStart, Yii::app()->locale->dateFormat));



public function setDateStarted($value)


  $this->DateStart = Yii::app()->dateFormatter->formatDateTime(CDateTimeParser::parse($value, 'yyyy-MM-dd'),'medium',null);


But when calling a date through AR in CListView it always returns 12-31-1969.

I am using MySQL with a date attribute. Anyone have any ideas?

do you have correct data in your model attribute $this->DateStart ?

try var_dump($this->DateStart); what do you see ?

Yes, that is there. If I just call DateStart directly I get my proper date in the format of Y-m-d but I need to reformat it hence the functions.

Ok, I think I found the problem but don’t know how to incorporate the solution.

The strtotime function seems to be the key to make the transition between English textual datetime and a Unix timestamp.

Can someone please help with modifying the functions I posted above to utilize the strtotime function? My attempts have gotten me nowhere.

Found a different approach.