setTimezoneOffset example



  /** * Tests setting the database offset. * * @covers ::setTimezoneOffset */
  public function testSetTimezoneOffset() {
    $database = $this->prophesize(Connection::class);
    $database->query()->shouldNotBeCalled();
    $date_sql = new SqliteDateSql($database->reveal());
    $date_sql->setTimezoneOffset(42);
  }

}


  /** * Tests setting the database offset. * * @covers ::setTimezoneOffset */
  public function testSetTimezoneOffset() {
    $database = $this->prophesize(Connection::class);
    $database->query("SET TIME ZONE INTERVAL '42' HOUR TO MINUTE")->shouldBeCalledTimes(1);
    $date_sql = new PostgresqlDateSql($database->reveal());
    $date_sql->setTimezoneOffset(42);
  }

}


  /** * Tests setting the database offset. * * @covers ::setTimezoneOffset */
  public function testSetTimezoneOffset() {
    $database = $this->prophesize(Connection::class);
    $database->query("SET @@session.time_zone = '42'")->shouldBeCalledTimes(1);
    $date_sql = new MysqlDateSql($database->reveal());
    $date_sql->setTimezoneOffset(42);
  }

}
public function setFieldTimezoneOffset(&$field$offset) {
    $this->dateSql->setFieldTimezoneOffset($field$offset);
  }

  /** * {@inheritdoc} */
  public function setupTimezone() {
    // Set the database timezone offset.     static $already_set = FALSE;
    if (!$already_set) {
      $this->dateSql->setTimezoneOffset('+00:00');
      $already_set = TRUE;
    }

    return parent::setupTimezone();
  }

  /** * {@inheritdoc} */
  public function getDateFormat($field$format$string_date = FALSE) {
    return $this->dateSql->getDateFormat($field$format);
  }
Home | Imprint | This part of the site doesn't use cookies.