Skip to content
Advertisement

wordpress date format change function

I am using below function getting dates from advanced custom fields pro plugin

my below code displays the dates from options ,

i want date format is different

JavaScript

i have used below code to change the format but not working , here the_field('event_start_date'); directly displaying without print/echo

JavaScript

Advertisement

Answer

A direct way is to use ob_get_clean() to capture the output, like this:

JavaScript

This is a bit overkill. Its best if you can find a function in the plugin that returns the data rather than outputs it.

Looking through the documentation for acf plugin, the function get_field() does this.

According to the acf documentation, the date is stored a bit differently. https://www.advancedcustomfields.com/resources/date-picker/

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement