Hi Sebastian,

You have to format the date for your view. If this is really woth the effort. I 
had a similar problem in a non cake Project.

I played around with 
$dateold = date("d.m.Y",strtotime($datefoo));
And
$datefoo= date("Y-m-d", strtotime("-$n day"));

Hope that helps. Be careful what format to validate!

Anja


-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag 
von Sebastian Göttschkes
Gesendet: Dienstag, 16. Dezember 2008 14:45
An: CakePHP
Betreff: cake 1.2 forms: date fields left empty => null in database?


Hi,

i got the following problem using cakePHP 1.2 RC3:

My Model 'Employee' has a attribute called 'birthday' (datatype:
DATE). In the add-view, I have the following code:
<?= $form->input('birthday',array('type'=>'text'));?>
If i left this field blank when adding an employee, this employee has the 
birthday '0000-00-00' saved in the database. I would rather like the birthday 
having the null-value, because 0000-00-00 is no valid birthday.

Additionally, if I add a valid birthday, it is saved correctly. When editing 
the employee, I would like to get the birthday viewed in the format dd.mm.yyyy. 
How can I tell cake to view the birthday like this?

I hope you guys can help me.

Thanks in advance,
Regards,
Sebastian


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to