Use Timestamp with new DateTime() in PHP

Posted on January 30, 2019 at 10:56 pm

You can use a unix timestamp within DateTime() like this:

$today    = new DateTime("@".time());
$tomorrow = new DateTime("@".strtotime("+13 months"));

See that we prepend “@” char before the timestamp.

Receive updates via email

Other Posts

Updated Posts