Support

Account

Home Forums ACF PRO Change date format with jquery Reply To: Change date format with jquery

  • That is most likely because ACF4 let’s you set the storage format and the other plugin uses whatever is stored in the field. ACF5 does not have this option and stores the dates in a standard way that allows sorting by date field. You can only sort by dates it the order is year/month/day.

    You should talk the the developers of the other plugin and ask them is there is a way to filter the values of custom fields before they are displayed.

    Your other choice would be to create a separate field that holds the value that you want displayed.

    
    add_filter('acf/update_value/name=the_acf_date_field_name', 'store_date_field_in_displayable_format', 10, 3);
    function store_date_field_in_displayable_format($value, $post_id, $field) {
      if ($value) {
        $new_value = date('jS F Y', strtotime($value));
        update_post_meta($post_id, 'field_name_to_use_in_other_plugin', $new_value);
      }
      return $value;
    }
    

    field_name_to_use_in_other_plugin needs to be a unique field name and then you use that field name to set up the other plugin. Personally, I’d go with the first option, but I can’t really help you figure out how to use that other plugin since I’ve never used it.