public function __construct($dateValue = '', DateTimeZone $timezone = null) { // Use the parent constructor to parse all accepted date formats parent::__construct($dateValue, $timezone); $this->setTimezone(new DateTimeZone(date_default_timezone_get())); // Use the parent constructor again with the parsed date, dropping the time element parent::__construct($this->format('Y-m-d 00:00:00'), $timezone); }
public function __construct($dateValue = '', DateTimeZone $timezone = null) { parent::__construct($dateValue, $timezone); // Always set the day to the same. $this->setDate(self::$yearMustAlwaysBe, self::$monthMustAlwaysBe, self::$dayMustAlwaysBe); }
public function __construct($dateValue = '', DateTimeZone $timezone = null) { parent::__construct($dateValue, $timezone); // Dates must be timezone agnostic as they don't store a time. We need to 'zero' out the time portion parent::setTime(0, 0, 0); }