php get unix timestamp from datetime code example
Example 1: php datetime object get unix timestamp
$date = new DateTime();
echo $date->getTimestamp();
Example 2: php unix timestamp to date
$currentTime = DateTime::createFromFormat( 'U', $timestamp );