date_default_timezone_set

Supported Versions: PHP 5 >= 5.1.0, PHP 7, PHP 8
Sets the default timezone used by all date/time functions in a script
<?php date_default_timezone_set(string $timezoneId): bool
<?php         $app->detectEnvironment(fn () => $config->get('app.env', 'production'));



        date_default_timezone_set($config->get('app.timezone', 'UTC'));



        mb_internal_encoding('UTF-8');

    }
<?php     protected function setUp(): void

    {

        $this->defaultTimezone = date_default_timezone_get();

        date_default_timezone_set('UTC');

    }



    protected function tearDown(): void
<?php     protected function tearDown(): void

    {

        date_default_timezone_set($this->defaultTimezone);

        Carbon::setTestNow(null);

        m::close();

    }
<?php     public function testValidateDateAndFormat()

    {

        date_default_timezone_set('UTC');

        $trans = $this->getIlluminateArrayTranslator();

        $v = new Validator($trans, ['x' => '2000-01-01'], ['x' => 'date']);

        $this->assertTrue($v->passes());
<?php     public function testDateEquals()

    {

        date_default_timezone_set('UTC');

        $trans = $this->getIlluminateArrayTranslator();

        $v = new Validator($trans, ['x' => '2000-01-01'], ['x' => 'date_equals:2000-01-01']);

        $this->assertTrue($v->passes());
<?php     public function testDateEqualsRespectsCarbonTestNowWhenParameterIsRelative()

    {

        date_default_timezone_set('UTC');

        $trans = $this->getIlluminateArrayTranslator();

        Carbon::setTestNow(new Carbon('2018-01-01'));
<?php     public function testBeforeAndAfter()

    {

        date_default_timezone_set('UTC');

        $trans = $this->getIlluminateArrayTranslator();

        $v = new Validator($trans, ['x' => '2000-01-01'], ['x' => 'Before:2012-01-01']);

        $this->assertTrue($v->passes());
<?php     public function testBeforeAndAfterWithFormat()

    {

        date_default_timezone_set('UTC');

        $trans = $this->getIlluminateArrayTranslator();

        $v = new Validator($trans, ['x' => '31/12/2000'], ['x' => 'before:31/02/2012']);

        $this->assertTrue($v->fails());
<?php     public function testWeakBeforeAndAfter()

    {

        date_default_timezone_set('UTC');

        $trans = $this->getIlluminateArrayTranslator();

        $v = new Validator($trans, ['x' => '2012-01-15'], ['x' => 'before_or_equal:2012-01-15']);

        $this->assertTrue($v->passes());
<?php     protected function tearDown(): void

    {

        date_default_timezone_set($this->currentTimezone);

    }



    public function testDateConvertsToDatabaseValue(): void
<?php     public function testDateRestsSummerTimeAffection(): void

    {

        date_default_timezone_set('Europe/Berlin');



        $date = $this->type->convertToPHPValue('2009-08-01', $this->platform);

        self::assertEquals('00:00:00', $date->format('H:i:s'));
<?php         }



        if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {

            date_default_timezone_set(Silencer::call('date_default_timezone_get'));

        }



        if (!$shutdownRegistered) {
<?php error_reporting(E_ALL);



if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {

    date_default_timezone_set(@date_default_timezone_get());

}



require __DIR__.'/../src/bootstrap.php';
<?php     public static function setUpBeforeClass(): void

    {

        self::$timezone = date_default_timezone_get();

        date_default_timezone_set('UTC');



        self::$prevTerminalEmulator = getenv('TERMINAL_EMULATOR');

        putenv('TERMINAL_EMULATOR');
<?php     public static function tearDownAfterClass(): void

    {

        date_default_timezone_set(self::$timezone);

        putenv('TERMINAL_EMULATOR'.(self::$prevTerminalEmulator ? '='.self::$prevTerminalEmulator : ''));

    }