I created a Custom Post Type (CPT) called 'Policies'. The post type as some Advanced Custom Fields. One of the fields for the CPT is a date-picker. When I generate a query to the Wordpress database, that date field shows as a normal integer, like 20180831 for August 31, 2018. When I change the column type to 'Date', the entry changes to 08/22/1970.
My date format for Advanced Custom Fields, WP DataTables and Wordpress settings are all the same (m/d/Y), but I've had no luck. Any assistance would be appreciated.
Yes we see that on table id 6. You have this issue because this CPT save date format in database that is not proper format for wpdatatables. We add function DATE_FORMAT in your query that will convert date format in defoult mysql format that wpdatatables also use, and we can see that now is working fine.
We are not familiar with that cpt and his functionality. My suggestion is to contact support of that plugin and check is it possible to change that throw cpt plugin.
If you have any more issues or questions feel free to open a new ticket, we will gladly help.
We'd greatly appreciate it if you could take a minute and leave a Review on CodeCanyon on this link. Thanks!
I created a Custom Post Type (CPT) called 'Policies'. The post type as some Advanced Custom Fields. One of the fields for the CPT is a date-picker. When I generate a query to the Wordpress database, that date field shows as a normal integer, like 20180831 for August 31, 2018. When I change the column type to 'Date', the entry changes to 08/22/1970.
My date format for Advanced Custom Fields, WP DataTables and Wordpress settings are all the same (m/d/Y), but I've had no luck. Any assistance would be appreciated.
Hi Komplexideas,
Thank yo ufor your purchase.
Yes we see that on table id 6. You have this issue because this CPT save date format in database that is not proper format for wpdatatables. We add function DATE_FORMAT in your query that will convert date format in defoult mysql format that wpdatatables also use, and we can see that now is working fine.
We replace
policies_meta_approval_date_tbl.meta_value
with
DATE_FORMAT(policies_meta_approval_date_tbl.meta_value,'%Y-%m-%d')
You can check on website.
Best regards.
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables
Thanks!
In the future, is there a way I can make that change directly within the custom post type? I appreciate your help.
Hi Komplexideas,
You are welcome.
We are not familiar with that cpt and his functionality. My suggestion is to contact support of that plugin and check is it possible to change that throw cpt plugin.
If you have any more issues or questions feel free to open a new ticket, we will gladly help.
We'd greatly appreciate it if you could take a minute and leave a Review on CodeCanyon on this link. Thanks!
Kind Regards,
Isidora Markovic
wpDataTables: FAQ | Facebook | Twitter | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Amelia demo sites | Docs
You can try our wpDataTables add-ons before purchase on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables