plain php get date with unix timestamp code example Example: php datetime object get unix timestamp $date = new DateTime(); echo $date->getTimestamp();