Thanks !
The solution was:
class AppController extends Controller
{
/**
* Initialization hook method.
*
* Use this method to add common initialization code like loading
components.
*
* @return void
*/
public function initialize()
{
$this->loadComponent('Flash');
Type::build('datetime')->useLocaleParser()->setLocaleFormat(
'dd-mm-yyyy');
Time::setToStringFormat('dd/MM/YYYY');
}
}
Em quinta-feira, 2 de abril de 2015 15:56:29 UTC-3, José Lorenzo escreveu:
>
> Read this:
>
>
> http://book.cakephp.org/3.0/en/orm/database-basics.html#parsing-localized-datetime-data
>
> On Thursday, April 2, 2015 at 6:10:58 PM UTC+2, Celso wrote:
>>
>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.