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
you can adjust number of character i mean if you need to show only 20 character then need to change 50 to 20
Here are two method which one you understand just use them in your code
<?php
$in=”Pellentesque habitant morbi tristique senectus eter netus et malesuada fames ac turpis egestas. Morbi purus nisl, blandit et eros id, pharetra tristique massa. Nulla facilisi. Curabitur lobortis urna eu neque congue, id cursus purus placerat. In malesuada est tellus. Nunc ac ullamcorper nibh. Maecenas lacus dolor, volutpat sed augue sit amet, maximus condimentum sem. Aenean nec egestas orci. Sed fringilla augue eget arcu consectetur interdum. Praesent sed dignissim risus. Ut lobortis dolor nec sagittis dapibus. Donec eget dolor vitae elit porta commodo in et magna. Nunc sapien nisl, euismod ac ex vitae, sodales feugiat lorem. Phasellus condimentum, nulla cursus porta mollis, nulla urna dapibus velit, vitae sagittis arcu risus vitae orci. Praesent leo nisi, laoreet id mauris nec, hendrerit feugiat lacus. Praesent vulputate lorem vel lobortis aliquam.”;
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.