frzxuwdrun
New Member
First I had problems with getting date's into my db see here. Now I have problems with getting it into the database on the right format. This is my code:\[code\]public function editAction() { if($this->_request->getParam('id')){ $id = $this->_request->getParam('id'); $data = http://stackoverflow.com/questions/2004872/$this->_evtObj->selectOneRow($id); // initialize the form //var_dump($data); $form = new JS_Form_EventForm(); $array = $data->toArray(); //$locale = Zend_Registry::get('locale'); $locale = new Zend_Locale(); $date1 = new Zend_Date($locale); $date1->set($array[0]['evt_startdate']); $array[0]['evt_startdate'] = $date1->get(); $array[0]['evt_enddate'] = date('%d-%m-%Y',(string)$array[0]['evt_enddate']); $form->populate($array[0]); $this->view->form =$form; }\[/code\]As you can see it populates the form with dates from the db. In the db the date is saved like 2010-01-15. As you can see in the above example i tried out two things:\[code\]locale = new Zend_Locale();$date1 = new Zend_Date($locale);$date1->set($array[0]['evt_startdate']);$array[0]['evt_startdate'] = $date1->get();\[/code\]This shows the date like: '1262300400'and:\[code\] $array[0]['evt_enddate'] = date('%d-%m-%Y',(string)$array[0]['evt_enddate']);\[/code\]this shows the date like: '%01-%01-%1970'I want the date to be shown like dd-mm-yyyyHow to deal with this? All this date business drives me mad. I am running zf 1.9.6any idea's?