How to display Custom Field date_value in schema with hours

date_value custom field

I just purchased an event listing website, and we have a custom section that allows us to post events with all sorts of information, from name to ticket price to start and end dates to hours, etc.

It is marked up fairly well in schema, but here’s the issue:

startDate displays as 2019-09-13T00:00:00 when I check it in Structured Data Testing Tool, and therefore in Google Events, it shows all events as starting at 12:00 AM.

The Custom Field that displays date has a value that looks like this:


Where the first number is end date, and the second number is start date.

I believe that since there is no Hours and Minutes for either of these, they are automatically being seen as 0000, or 12:00 AM.

We do have an Hours section, but I don’t think this is marked up in schema, and is only for display on the published page itself. Here’s what the hours section looks like in custom fields:

My ideal solution would be:

IF hours custom field has a value, append to date_value custom field

(So if the first hours field displays 7:00 PM, 20190914.20190913 would automatically turn into 20190914.201909131900)

IF hours custom field has no value, remove 0000 from date_value so that only the date is displays in schema, NOT the time

The other solution that may be possible is simply to add a “starting time” selector to the date_value custom field. Right now it just says Add Dates and I can select Month, Day, Year.

I know enough to likely be able to add any code correctly, but not enough to create the code.

Here’s what the event entry section looks like currently:

event entry section in WordPress

Any tips on how to solve this? Specifically: include the correct starting time in schema, OR remove time altogether.


Read more here:: How to display Custom Field date_value in schema with hours

Leave a Reply

Your email address will not be published. Required fields are marked *