Support

Account

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

Solving

Returned Date always in Y-m-d

  • 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.

  • 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.

  • 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)

The topic ‘Returned Date always in Y-m-d’ is closed to new replies.