Contao\Date::__construct PHP Method

__construct() public method

Set the object properties
public __construct ( integer $strDate = null, string $strFormat = null )
$strDate integer An optional date string
$strFormat string An optional format string
    public function __construct($strDate = null, $strFormat = null)
    {
        $this->strDate = $strDate !== null ? $strDate : time();
        $this->strFormat = $strFormat !== null ? $strFormat : static::getNumericDateFormat();
        if (!preg_match('/^-?[0-9]+$/', $this->strDate) || preg_match('/^[a-zA-Z]+$/', $this->strFormat)) {
            $this->dateToUnix();
        }
    }