# Set default date/time in Mautic Form Field

**URL:** https://forum.mautic.org/t/set-default-date-time-in-mautic-form-field/27728
**Category:** Product Support
**Tags:** mautic-4
**Created:** [April 16, 2023, 5:00pm UTC](https://forum.mautic.org/t/set-default-date-time-in-mautic-form-field/27728 "2023-04-16T17:00:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![deejmer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/deejmer/32/588_2.png) [@deejmer](https://forum.mautic.org/u/deejmer)
#### Post date: [April 16, 2023, 5:00pm UTC](https://forum.mautic.org/t/set-default-date-time-in-mautic-form-field/27728/1 "2023-04-16T17:00:17Z")

</div>

**Your software**  
My Mautic version is: 4.4.7  
My PHP version is: 7.4.33  
My Database type and version is: MySQL 5.7.36

**Your problem**  
My problem is: I need to set a default date and time on a read-only field in a Mautic form

These errors are showing in the log: Not applicable

Steps I have tried to fix the problem: I have tried setting a string value for date and time, as well as trying a UNIX time stamp, in the Default Value for a custom Date/Field time. It does not default a date in the Javascript date picker.

Does anyone know how to go about doing this? Thanks!

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [April 17, 2023, 7:31pm UTC](https://forum.mautic.org/t/set-default-date-time-in-mautic-form-field/27728/2 "2023-04-17T19:31:12Z")

</div>

Hi @deejmer ,  
Just an idea, that I haven’t tested.

> **[GitHub - mtcextendee/mautic-form-actions-bundle](https://github.com/mtcextendee/mautic-form-actions-bundle)**
>
> Contribute to mtcextendee/mautic-form-actions-bundle development by creating an account on GitHub.

This allows you to overwrite data, maybe you can use the TWIG syntax to save the current timestamp.

---

<div class="post-metadata">

### Author: ![deejmer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/deejmer/32/588_2.png) [@deejmer](https://forum.mautic.org/u/deejmer)
#### Post date: [April 18, 2023, 2:35am UTC](https://forum.mautic.org/t/set-default-date-time-in-mautic-form-field/27728/3 "2023-04-18T02:35:11Z")

</div>

That’s an interesting idea/plugin. I don’t need the CURRENT time stamp. This is for an event registration - the idea is to default to a date and make it read only so it’s saved to the DB and also shown to the user. Was hoping to find a javascript hack or something, but unsure which JS library is even being used for that date/time field control…

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [April 18, 2023, 4:42am UTC](https://forum.mautic.org/t/set-default-date-time-in-mautic-form-field/27728/4 "2023-04-18T04:42:15Z")

</div>

Oh ok, I misunderstood.  
The most obvious solution would be to embed the form by copying the js and html where you modify the html by hardcoding the placeholder value.

---

<div class="post-metadata">

### Author: ![deejmer](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/deejmer/32/588_2.png) [@deejmer](https://forum.mautic.org/u/deejmer)
#### Post date: [April 26, 2023, 2:45am UTC](https://forum.mautic.org/t/set-default-date-time-in-mautic-form-field/27728/5 "2023-04-26T02:45:36Z")

</div>

I wasn’t able to figure it out with that idea, but I did find a solution. It turned out I just hadn’t tried enough date formats. Once I made the default date/time this format: YYYY-MM-DD HH:MM (or 2023-04-25 14:00), it took! Thanks for your suggestions!
