get date php format code example
Example 1: date to string php
$date_string_prepared = date_create("2020-08-07");
$date_string = $date_string_prepared->format("d M Y");
// result 07 Jul 2020
Example 2: date time format php
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm
Example 3: php date
$dateTime = new \DateTime();
/**
* You can get the string by using format
*/
$dateTime->format('Y-m-d H:i:s');