Skip Navigation

[Resolved] Issue with Toolset Types date fields and Schema Pro Plugin

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to map Toolset date fields to Schema Pro dates, but the Schema Pro date format should be like 2019-01-26. Toolset's format is like 1525478400. I would like to discuss the issue with Schema Pro's developers. What should I tell them?

Solution: Toolset uses a format called Unix timestamps. A developer should be able to convert a Unix timestamp into any formatted date using PHP or another programming language. As a fallback, the Types field shortcode will produce any PHP date format you specify. You could use those shortcodes to generate some readable format for Schema Pro.

Relevant Documentation:
https://en.wikipedia.org/wiki/Unix_time
https://www.unixtimestamp.com/

This support ticket is created 5 years, 9 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by peterS-14 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1207744
Schema Pro Event Dates Error.JPG

I am trying to: generate schema.org info's with Schema Pro Plugin for Events listings from date fields made with Toolset Types.

The issue is that when I map the Toolset Types created date fields they show values like 1525478400 instead of a google conform date when checking in the Google Structured Data Testing Tool

I expected to see: a date like 2019-01-26

Now my question is: what should the devs at schema pro look for to convert the Toolset data field value to the proper ISO 8601 value as defined by schema.org

Any hint will be very appreciated ?

#1207978

Hi, Toolset uses Unix timestamps to store dates in the database. It's a fairly common format, and a developer should be able to convert these numbers as needed. For example PHP lets you format a date like this:

$nice_format = date('Y-m-d',  1525478400 );

https://en.wikipedia.org/wiki/Unix_time
https://www.unixtimestamp.com/

Also the Types field shortcode will allow you to apply any PHP date format, so if you're able to use shortcodes to map these fields you could do something like this to output the proper format:

[types field='your-field-slug' style='text' format='Y-m-d' id='123456'][/types]

Replace your-field-slug with your date field slug, and replace 123456 with the numeric ID of the post, or a nested wpv-post-id shortcode.

#1207993

Hi Christian

Thanks a lot for looking into this and providing a precise solution I can forward to the Schema Pro devs and and also the fallback option in case I need to add the dates via type fields shortcode into the corresponding content templates or views.

My issue is resolved now. Thank you!