# Save time value, missing seconds if 00

**URL:** <https://discourse.cakephp.org/t/save-time-value-missing-seconds-if-00/8557>\
**Category:** Need Help\
**Created:** [October 28, 2020, 10:47pm UTC](https://discourse.cakephp.org/t/save-time-value-missing-seconds-if-00/8557 "2020-10-28T22:47:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shadowx.jb](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@shadowx.jb](https://discourse.cakephp.org/u/shadowx.jb)\
**Post date:** [October 28, 2020, 10:47pm UTC](https://discourse.cakephp.org/t/save-time-value-missing-seconds-if-00/8557/1 "2020-10-28T22:47:45Z")

</div>

I post time 01:00:00 , after post form result is -\> `$this->request->getData()`

`'time_winner' => '01:00',`

If post 01:00:01

result is ok

`'time_winner' => '01:00:01',`

Please advice on how to get the full time format? Because the patch entity then does not work.

Thank you

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [October 29, 2020, 12:00am UTC](https://discourse.cakephp.org/t/save-time-value-missing-seconds-if-00/8557/2 "2020-10-29T00:00:51Z")

</div>

What does your form look like? Do you have some JavaScript or something on that? Because what I’m used to seeing with default code for time fields is an array with hour, minute and second separated.

---

<div class="post-metadata">

**Author:** ![shadowx.jb](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@shadowx.jb](https://discourse.cakephp.org/u/shadowx.jb)\
**Post date:** [October 29, 2020, 5:35am UTC](https://discourse.cakephp.org/t/save-time-value-missing-seconds-if-00/8557/3 "2020-10-29T05:35:40Z")

</div>

Input is:

`<input type="time" name="time_winner" required="required" id="time-winner" step="1" value="01:00:00">`

No JavaScript, but input type text is return seconds… 🙄 So it happens in chrome, firefox is ok

---

<div class="post-metadata">

**Author:** ![Tobse](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/tobse/32/236_2.png) [@Tobse](https://discourse.cakephp.org/u/Tobse)\
**Post date:** [October 29, 2020, 8:59am UTC](https://discourse.cakephp.org/t/save-time-value-missing-seconds-if-00/8557/4 "2020-10-29T08:59:44Z")

</div>

This issue will be fixed in Cakephp 4.2. [https://github.com/cakephp/cakephp/issues/14957](https://github.com/cakephp/cakephp/issues/14957)  
As a workaround you can reformat the time-data in a beforeMarshal-function in your model like this:

```auto
public function beforeMarshal(EventInterface $event, ArrayObject $data, ArrayObject $options)
    {
        if ($data['departuretime']) {
            $data['departuretime'] = new FrozenTime($data['departuretime']);
        }
    }

```

Hope this helps.
