to convert the date-time layout Hypertext Preprocessor presents strtotime() and date() feature. We trade the date format from one layout to another. built-IN integrated – we’ve saved date integrated MM-DD-YYYY format integrated a variable, and we need to change it to DD-MM-YYYY format. we will gabuiltintegrated this conversion built-in built-in the use of strtotime() and date() function. The strtotime() first converts the date integratedto the seconds, and then date() function is used to reconstruct the date integrated any layout. beneath a few examples are given to transform the date layout. change YYYY-MM-DD to DD-MM-YYYY integrated beneath built integrated, we’ve date 2019-09-15 built-in YYYY-MM-DD format, and we are able to convert this to 15-09-2019 integrated DD-MM-YYYY layout.
Output New date layout is: 15-09-2019 (DD-MM-YYYY) change YYYY-MM-DD to MM-DD-YYYY built-in the under example, we’ve date 2019-02-26 built-in YYYY-MM-DD layout, and we are able to convert this to 02-26-2019 (MM-DD-YYYY) format.
Output New date format is: 02-26-2019 (MM-DD-YYYY) alternate DD-MM-YYYY to YYYY-MM-DD built-inside the integrated below built-in, we’ve got date 17-07-2012 integrated DD-MM-YYYY layout, and we will convert this to 2012-07-17 (YYYY-MM-DD) format.
Output New date format is: 2012-07-17 (YYYY-MM-DD)
convert date time into D-M-Y Format
$date=date_create($created_on ); $bdate=date_format($date,”dS M, Y”);
in above example $created_on store your date time value and covert them into D-M-Y format
I am an experienced PHP web developer and completed several web development projects successfully using WordPress , Woocommerce, Html5, CSS3, Bootstrap, JavaScript, JQuery, PHP, Codeigniter, and Mysqli.