Convert and change date format date sequence php mysql


How to convert date format DD-MM-YYYY to date format MM/DD/YYYY,

Convert date sequence in php mysql, change date format in php

Convert date sequence in php, how to used date_create() function in php

How Do I Convert and change MM/DD Date Format to DD/MM


How to convert and change date format from one to another in php mysql

In Mysql database stores dates in the different format and fetch in different format with php



first method

$startdate = 07/03/2016;

$date_array = explode("/",$startdate); // split the array

$var_day = $date_array[0]; //day seqment

$var_month = $date_array[1]; //month segment

$var_year = $date_array[2]; //year segment

$new_date_format = "$var_year-$var_day-$var_month"; // join them together

$new_date_format = "$var_day-$var_month-$var_year"; // join them together


2nd method



echo date_format($date,"Y/m/d H:i:s");