Support

Account

Home Forums Bug Reports Returned Date always in Y-m-d

Solving

Returned Date always in Y-m-d

    • trex005

    • October 5, 2016 at 5:59 pm

    I have numerous date fields which I am trying to return in Ymd format when using get_field().

    I have tried setting the return format to 20161005 and to Ymd and they continue to be returned in Y-m-d format.

    Since the format I need is also the way it is stored in the database, I have tried passing false as the third parameter to get_field() as well but they still continue to be returned in Y-m-d format.

    I can get around this by just stripping the hyphens, but I thought you should be aware.

    • trex005

    • October 5, 2016 at 6:05 pm

    I should note, I have also tried running wp_cache_flush() before calling get_field() just in case the field was cached from a previous call.

    • James

    • October 6, 2016 at 2:52 pm

    Hi @trex005

    I’ve just tested it on my installation but failed to reproduce the issue. Maybe there’s something on your site that prevents ACF from formatting the date. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.

    If the issue persists, could you please share the JSON or XML export file of your field group so I can test it out on my installation?

    Thanks 🙂

  • I’m having the same freak issue. It just started for no apparent reason. I even tried recreating the field, updating the post, updating the field group. WTF?!

  • So, it looks like having tabs in your ACF field group is the culprit! Major bug!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.