src/Clock.php
static function dateTime(?\DateTimeZone $timezone = null): \DateTime
    {
        if (self::$now !== null) {
            $now = \DateTime::createFromFormat('U.u', sprintf('%.6F', self::$now));
            $now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));

            return $now;
        }

        return new \DateTime('now', $timezone);
    }
static function dateTime(?\DateTimeZone $timezone = null): \DateTime
    {
        if (self::$now !== null) {
            $now = \DateTime::createFromFormat('U.u', sprintf('%.6F', self::$now));
            $now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));

            return $now;
        }

        return new \DateTime('now', $timezone);
    }
static function dateTime ( ? \ DateTimeZone $ timezone = null ) : \ DateTime { if ( self :: $ now !== null ) { $ now = \ DateTime :: createFromFormat ( 'U.u' , sprintf ( '%.6F' , self :: $ now ) ) ; $ now -> setTimezone ( $ timezone ?? new \ DateTimeZone ( date_default_timezone_get ( ) ) ) ; return $ now ; } return new \ DateTime ( 'now' , $ timezone ) ; }
Get the current date-time

If no time zone is specified, then the default time zone will be used.

The default time zone is specified by the date.timezone INI setting or the date_default_timezone_set() function.
Get the current date - time