Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
    Post Undeleted by Pieter Goosen
2 added 499 characters in body
source | link

EDIT

You should be using date_create_from_format or its alias DateTime::createFromFormat() to convert on format to another. You can try the following

$date = DateTime::createFromFormat('m-d-Y', '03-09-2015');
echo $date->format('d-m-Y');

This will convert 03-09-2015 to 09-03-2015

ORIGINAL ANSWER

This is more a PHP question than Wordpress question. You can simply use str_replace to change the / in your date to -. You are not changing the format, so no need for date_format or any other date related functions

You can try something like

$date = '03/09/2015';
$modified_date = str_replace( '/', '-', $date );
echo $modified_date;

This will output 03-09-2015

This is more a PHP question than Wordpress question. You can simply use str_replace to change the / in your date to -. You are not changing the format, so no need for date_format or any other date related functions

You can try something like

$date = '03/09/2015';
$modified_date = str_replace( '/', '-', $date );
echo $modified_date;

This will output 03-09-2015

EDIT

You should be using date_create_from_format or its alias DateTime::createFromFormat() to convert on format to another. You can try the following

$date = DateTime::createFromFormat('m-d-Y', '03-09-2015');
echo $date->format('d-m-Y');

This will convert 03-09-2015 to 09-03-2015

ORIGINAL ANSWER

This is more a PHP question than Wordpress question. You can simply use str_replace to change the / in your date to -. You are not changing the format, so no need for date_format or any other date related functions

You can try something like

$date = '03/09/2015';
$modified_date = str_replace( '/', '-', $date );
echo $modified_date;

This will output 03-09-2015

    Post Deleted by Pieter Goosen
1
source | link

This is more a PHP question than Wordpress question. You can simply use str_replace to change the / in your date to -. You are not changing the format, so no need for date_format or any other date related functions

You can try something like

$date = '03/09/2015';
$modified_date = str_replace( '/', '-', $date );
echo $modified_date;

This will output 03-09-2015