Constructs a date object.
mixed $time: A DateTime object, a date/input_time_adjusted string, a unix timestamp, or an array of date parts, like ('year' => 2014, 'month => 4). Defaults to 'now'.
mixed $timezone: PHP DateTimeZone object, string or NULL allowed. Defaults to NULL.
string $format: PHP date() type format for parsing the input. This is recommended to use things like negative years, which php's parser fails on, or any other specialized input with a known format. If provided the date will be created using the createFromFormat() method. Defaults to NULL. @see http://us3.php.net/manual/en/datetime.createfromformat.php
array $settings:
Overrides DateTimePlus::__construct
public function __construct($time = 'now', $timezone = NULL, $format = NULL, $settings = array()) {
// We can set the langcode and country using Drupal values.
$settings['langcode'] = !empty($settings['langcode']) ? $settings['langcode'] : language(Language::TYPE_INTERFACE)->langcode;
$settings['country'] = !empty($settings['country']) ? $settings['country'] : config('system.date')
->get('country.default');
// Instantiate the parent class.
parent::__construct($time, $timezone, $format, $settings);
}