Skip Navigation

[Resolved] Numbers instead of formatted date

This support ticket is created 3 years, 12 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by johanB-4 3 years, 12 months ago.

Assisted by: Shane.

Author
Posts
#2281879
date-numbers.png

Tell us what you are trying to do?
I created a custom content type called "activity" and several custom fields. One of them is a "date/time" field.
In my content template i show the details of the activity and i include a gravity form so visitors can register for that activity.
In my gravity form i use 2 hidden fields. One holds the post title, the other should hold the date.
I use an extension for gravityforms to fill these hidden fields: hidden link

Everything is working perfect. Except, when i select my date field to populate my hidden field, i get a bunch of numbers instead of the date. I already contacted Gravitywiz support and they tell me it has to do with the way toolset stores the date in the database. They suggest using ACF since it works with ACF. Can you imagine 🙁

Therefore i'm putting my hopes on you guys.
Could you please give me any help?
Link to an example: hidden link
I include a screenshot. You can see the Toolset custom date field shown perfect on the website. In the source code you can see the hidden field with value of numbers. It works perfect for all other fields i create with toolset, just not the date field.

Thanks in advance.
Sincerly,
Johan.

#2282119

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Johan,

Thank you for getting in touch.

Our Date field values are stored as a timestamp in the database. If gravity forms is retrieving that field directly from the database then you will need to convert it from a timestamp to a human readable format.

If gravity forms has a hook that interfaces with the fields when they are being retrieved from the database then we can intercept the value and convert it.

Without this the only other option is to convert the timestamp using javascript.

Thanks,
Shane

#2282805

I reached back out to the people from GravityWiz.
They replayed:
----
Yes, this will require some custom code to convert the TimeStamp value in the Database into a Date. We have a hook that can be used to modify values when they're populated:
hidden link
Below is a link to a snippet that uses that hook to convert the populated value from a unix timestamp to yyyy-mm-dd. You'll need to modify a couple of things in the snippet in order to use it. The instructions are in the snippet itself.
hidden link
Here's a walkthrough on how to install the snippet: How do I install a snippet?
----

So, i will give this a try. Thank you for your input!
greetings,
Johan.