I want to chage date format to d-m-y
means day-month-year format . I have added
'date_format' => __( 'd-m-Y', 'cmb2' )
But not working. now it's month-day-year formated . Actually i want to change date format like month-day-year to day-month-year.
Here is code:
add_filter( 'cmb_meta_boxes', 'cmb_sample_metaboxes' );
function cmb_sample_metaboxes( array $meta_boxes ) {
$prefix = '_single_';
$meta_boxes[] = array(
'id' => 'coupons_metabox',
'title' => 'Coupon details',
'pages' => array( 'coupons', ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array( // Text Input
'name' => 'The date the coupon expires', // <label>
'desc' => 'The expiration date of the coupon. Leave if empty if the coupon doesn\'t have an expiration date.', // description
'id' => $prefix . 'date', // field id and name
'type' => 'text_date_timestamp', // type of field,
),
)
);
// Add other metaboxes as needed
return $meta_boxes;
}
add_action( 'init', 'cmb_initialize_cmb_meta_boxes', 9999 );
/**
* Initialize the metabox class.
*/
function cmb_initialize_cmb_meta_boxes() {
if ( ! class_exists( 'cmb_Meta_Box' ) )
require_once 'init.php';
}