# Problem with date to display in CakePHP 3.8 form field

**URL:** <https://discourse.cakephp.org/t/problem-with-date-to-display-in-cakephp-3-8-form-field/8402>\
**Category:** Need Help\
**Created:** [September 21, 2020, 12:02pm UTC](https://discourse.cakephp.org/t/problem-with-date-to-display-in-cakephp-3-8-form-field/8402 "2020-09-21T12:02:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpferreira](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@dpferreira](https://discourse.cakephp.org/u/dpferreira)\
**Post date:** [September 21, 2020, 12:02pm UTC](https://discourse.cakephp.org/t/problem-with-date-to-display-in-cakephp-3-8-form-field/8402/1 "2020-09-21T12:02:31Z")

</div>

I have a problem that I want to show the date in the Spanish format dd/MM/yyyy inside the form field but I can’t do it, I have modified the frozendate in bootstrap, in appcontroller, I have looked at what the request returns before and after the patchentity but there is no way to format it.

The message displayed is this in the browser inspector console: “The specified value” 10/9/20 “does not conform to the required format,” yyyy-MM-dd “.”

Does anyone know what steps to follow to modify FrozenDate or Date and that the date is displayed correctly within the input from the database.

Thank you very much for the help

---

<div class="post-metadata">

**Author:** ![debito](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@debito](https://discourse.cakephp.org/u/debito)\
**Post date:** [May 20, 2021, 9:17am UTC](https://discourse.cakephp.org/t/problem-with-date-to-display-in-cakephp-3-8-form-field/8402/2 "2021-05-20T09:17:47Z")

</div>

I believe the Danish format is the same and I am experiencing the same challenge, so I would be grateful if someone has the answer for this 🙏

---

<div class="post-metadata">

**Author:** ![dreamingmind](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dreamingmind/32/1857_2.png) [@dreamingmind](https://discourse.cakephp.org/u/dreamingmind)\
**Post date:** [May 20, 2021, 2:22pm UTC](https://discourse.cakephp.org/t/problem-with-date-to-display-in-cakephp-3-8-form-field/8402/3 "2021-05-20T14:22:35Z")

</div>

It sounds like you are only trying to adjust the Time object in the belief that it will change the form inputs. But those are actually under your control:

I have not needed to change the default input templates my self so I don’t have first-hand knowledge, but I believe [this is what you want](https://book.cakephp.org/4/en/views/helpers/form.html#customizing-the-templates-formhelper-uses)

Also, searching the formum for ‘form template’ will return many posts which may help

---

<div class="post-metadata">

**Author:** ![Mentis](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/mentis/32/994_2.png) [@Mentis](https://discourse.cakephp.org/u/Mentis)\
**Post date:** [May 20, 2021, 3:35pm UTC](https://discourse.cakephp.org/t/problem-with-date-to-display-in-cakephp-3-8-form-field/8402/4 "2021-05-20T15:35:21Z")

</div>

@debito : Are you using CakePHP 3 or 4?

Are you trying to display the value from database (formatted as `yyyy-mm-dd`) as your locale `dd-mm-yyyy`?

**CakePHP 3**

You need to change the date-widget template in the FormHelper as @dreamingmind mentioned.

You can do that by adding this to your `src/View/AppView.php` file:

```php
$this->loadHelper('Form', [
    'templates' => [
        'dateWidget' => '{{day}}{{month}}{{year}}{{hour}}{{minute}}{{second}}{{meridian}}'
    ],
]);

```

Before:

![bilde](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/f/f9916152be3038abaff06daaa7906c0aa182944a.png)

After:

![bilde](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/b/b62ccb7a622e9451500c1cde473556fbe647798f.png)

**CakePHP 4**  
I could not replicate the issue in Cake 4 as the form is displayed by the locale of my browser (checked Firefox and Chrome). When using my Norwegian locale, it as displayed as `dd-mm-yyyy`. When I changed to English (US) it was displayed as `mm-dd-yyyy`

---

<div class="post-metadata">

**Author:** ![debito](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@debito](https://discourse.cakephp.org/u/debito)\
**Post date:** [May 20, 2021, 8:23pm UTC](https://discourse.cakephp.org/t/problem-with-date-to-display-in-cakephp-3-8-form-field/8402/5 "2021-05-20T20:23:19Z")

</div>

@Mentis  
I am using CakePHP 3.

Thank you very much for the answer! 🙏  
You nailed the challenge and it solved my problem. Thanks!
