Okay
  Public Ticket #1714293
Date Formatting when generating a query to WordPress database
Closed

Comments

  • Komplexideas started the conversation

    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.

  •   Komplexideas replied privately
  •  471
    Isidora replied

    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: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  • Komplexideas replied

    Thanks!

    In the future, is there a way I can make that change directly within the custom post type? I appreciate your help.

  •  471
    Isidora replied

    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: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables