Thursday, April 2, 2015

How to set Cake 3.0 to save with different date format ?

Hi guys I have a table in Mysql with a date field,  and I need to allow my user writes something like 31/12/2015.


echo $this
->Form->input('data_nascimento', ['type' => 'text', 'maxlength'=> '10']);

I've tried
Time::$defaultLocale = 'pt-BR';

in AppController but the problem persists...
and 
'timezone' => 'BRT'
in app.php does not works

If I update the value directly in MySQL and use the
Time::setToStringFormat('dd/MM/YYYY');
in AppController the date is showed in a nice format however my real problem is how to save() because I don't know how change the locale of Cake 3.0.


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: