# Date and Time field

**URL:** <https://community.gravityforms.com/t/date-and-time-field/4998>\
**Category:** Get Help\
**Tags:** gform\_replace\_merge\_tags, date, time-selector\
**Created:** [June 4, 2020, 6:44am UTC](https://community.gravityforms.com/t/date-and-time-field/4998 "2020-06-04T06:44:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon58555961](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@anon58555961](https://community.gravityforms.com/u/anon58555961)\
**Post date:** [June 4, 2020, 6:44am UTC](https://community.gravityforms.com/t/date-and-time-field/4998/1 "2020-06-04T06:44:37Z")

</div>

Is there a Date and Time field available in Gravity Forms? I need to send data in this format: YYYY-MM-DD HH:MM:SS to an external API. I guess i then need a field where both date and time can be set.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 4, 2020, 2:19pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/2 "2020-06-04T14:19:24Z")

</div>

Hi Morgan. Take a look at the gform\_replace\_merge\_tags filter, specifically example 9:

> **[gform\_replace\_merge\_tags - Gravity Forms Documentation](https://docs.gravityforms.com/gform_replace_merge_tags/#7-custom-date-merge-tag)**
>
> Use this filter to replace custom merge tags. You can add custom merge tags via the gform\_custom\_merge\_tags filter.

That will give you a merge tag you can use to output a date in whatever format you need (you will need to modify this line:

`$local_date = date_i18n( 'Y-m-d', $local_timestamp, true );`

and change Y-m-d to whatever format gives you YYYY-MM-DD HH:MM:SS. I think it would be this:

`$local_date = date_i18n( 'Y-m-d H:i:s', $local_timestamp, true );`

If you need that date/time stored in the entry, so you can map it to your API using the Webhooks add-on or something like that, you will need a slightly different approach to populate a field with a date/time in that format.

---

<div class="post-metadata">

**Author:** ![user5dc2d1dad445f392](https://avatars.discourse-cdn.com/v4/letter/u/b5e925/32.png) [@user5dc2d1dad445f392](https://community.gravityforms.com/u/user5dc2d1dad445f392)\
**Post date:** [June 4, 2020, 4:33pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/3 "2020-06-04T16:33:46Z")

</div>

Hi Chris,

I also need a Date/Time Picker. I tried following your instructions regarding the merge tags but did not succeed. Could you elaborate on this approach? I inserted the snippet into the common.php and added the time format as you mentioned above. Unfortunately it didn’t work ☹

Thanks and best regards

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 4, 2020, 6:39pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/4 "2020-06-04T18:39:08Z")

</div>

The snippet should go into your theme functions.php file. You should not modify any Gravity Forms core file. I’m sorry I did not mention that earlier.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 4, 2020, 6:41pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/5 "2020-06-04T18:41:18Z")

</div>

The code does not create a date/time picker though. It gives you a merge tag you an use in your notification to show the date/time in a specific format

---

<div class="post-metadata">

**Author:** ![user5dc2d1dad445f392](https://avatars.discourse-cdn.com/v4/letter/u/b5e925/32.png) [@user5dc2d1dad445f392](https://community.gravityforms.com/u/user5dc2d1dad445f392)\
**Post date:** [June 4, 2020, 7:05pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/6 "2020-06-04T19:05:47Z")

</div>

> [@chrishajer](#):
>
> Y-m-d H:i:s

Thank you for your answer.  
I really need a date / timer picker though. Do you know any workaround?

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 4, 2020, 8:39pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/7 "2020-06-04T20:39:46Z")

</div>

I don’t know of one currently. There used to be one here:

[https://gravityextend.com/gravity-forms-add-on/date-time-picker/](https://gravityextend.com/gravity-forms-add-on/date-time-picker/)

But that appears to be gone, and I could not find it on github.

---

<div class="post-metadata">

**Author:** ![wizontheweb](https://avatars.discourse-cdn.com/v4/letter/w/e79b87/32.png) [@wizontheweb](https://community.gravityforms.com/u/wizontheweb)\
**Post date:** [June 30, 2020, 11:06am UTC](https://community.gravityforms.com/t/date-and-time-field/4998/8 "2020-06-30T11:06:45Z")

</div>

Hi, I was looking for something similar, came across this plugin which I have working with gravity forms [https://wordpress.org/plugins/date-time-picker-field/](https://wordpress.org/plugins/date-time-picker-field/)

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [June 30, 2020, 2:22pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/9 "2020-06-30T14:22:02Z")

</div>

Thanks for that @wizontheweb!

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 4, 2022, 6:02pm UTC](https://community.gravityforms.com/t/date-and-time-field/4998/10 "2022-01-04T18:02:43Z")

</div>


