How to customize date and time format in Frontend Manager form fields

By default Frontend Manager form fields has a default format for the date and time, but sometime we need to change in our own format.

To change or alter the format of the date and time is very easy, just copy and paste this sample code to your theme functions.php file.


function custom_wpcfe_date_format_callback( $dateformat ){

   $dateformat = 'mm/dd/yyyy';

   return $dateformat;

}

function custom_wpcargo_date_format_callback( $dateformat ){

   $dateformat = 'm/d/Y';

   return $dateformat;

}

// some filters don't work and sometimes need to be added inside wordpress' "init" hook

function wpcargo_custom_wp_init_callback(){

    add_filter('wpcfe_date_format', 'custom_wpcfe_date_format_callback', 11, 1);

    add_filter('wpcargo_date_format', 'custom_wpcargo_date_format_callback', 9, 1);

    // to change the time format into twelve hour format. By default time format is a 24 Hour time format

    add_filter('wpcfe_time_twelvehour_format', '__return_true');

}
add_action('init', 'wpcargo_custom_wp_init_callback', 99);

For additional information regarding date and time format read this Documentation

0
    0
    Your Cart
    Your cart is emptyReturn to Shop