Re: Formbuilder: Date
| From: | Justin Patrin | Date: | Tue, 22 Jun 2004 18:38:37 +0000 |
| Subject: | Re: Formbuilder: Date | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13252@lists.php.net to get a copy of this message | ||
Tobias Nix wrote:
Sorry, I've never used the time stuff. Make sure that the format you're giving is what your database itself is using. For mysql, for example, a datetime should probably be formatted "Y-m-d H:i:s". If you don't want your field formatted this way in the form, specify the one you want, then use callbacks for date conversion. -- paperCrane <Justin Patrin>Try adding this to your [DB_DataObject_FormBuilder] ini section: date_element_format = "Y M d"Display part is working here. Changed the tablefield from int(11) to datetime. From year,month,day and hours everything is saved correct. Minutes and seconds get lost somewhere and alway set to zero in the Database. In ini section i set date_element_format = "d.m.Y H:i:s" Another thing: if i setup a default date in postGenerateForm, the date/time is always set to actual date, but saved correctly in database. function postGenerateForm(&$form) {$form->setDefaults(array( 'added' => array( 'd'=>date ('d', time()), 'm'=>date ('m', time()), 'Y'=>date ('Y', time()), 'H'=>date ('H', time()), 'i'=>date ('i', time()), 's'=>date ('s', time())));'added' is my datetime field. Any hints? Regards, Tobias.