public function setDateByTimezone($timezone) {
    if (is_string($timezone)) {
      $timezone = new DateTimeZone($timezone);
    }
    $this->convertedTimezone = $timezone;
    $new_date_utc = $this->date->getTimeStamp() - $timezone->getOffset($this->date);
    $new_date = new DateTime();
    $new_date->setTimestamp($new_date_utc);
    $this->date = $new_date;
  }
public function setDateByTimezone($timezone) {
    if (is_string($timezone)) {
      $timezone = new DateTimeZone($timezone);
    }
    $this->convertedTimezone = $timezone;
    $new_date_utc = $this->date->getTimeStamp() - $timezone->getOffset($this->date);
    $new_date = new DateTime();
    $new_date->setTimestamp($new_date_utc);
    $this->date = $new_date;
  }
public function setDateByTimezone ( $ timezone ) { if ( is_string ( $ timezone ) ) { $ timezone = new DateTimeZone ( $ timezone ) ; } $ this -> convertedTimezone = $ timezone ; $ new_date_utc = $ this -> date -> getTimeStamp ( ) - $ timezone -> getOffset ( $ this -> date ) ; $ new_date = new DateTime ( ) ; $ new_date -> setTimestamp ( $ new_date_utc ) ; $ this -> date = $ new_date ; }
Update the date with the offset from a given timezone.

@param $timezone
Can be either a string or a DateTimeZone object.
Update the date with the offset from a given timezone .