new DateTime php code example
Example 1: date now php
date('Y-m-d H:i:s')
Example 2: php datetime
$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');
Example 3: php datetime create
$date = DateTime::createFromFormat('d-m-Y', '15-12-2020');
Example 4: datetime php
date_format ( DateTimeInterface $object , string $format )
$dateTime = new \DateTime();
$dateTime->format('y-j-d H:i:s T');
date('g:i A m-d-Y', strtotime($date_time));
Example 5: datetime php
$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');