Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TimeZone.php

function TimeZone::transform

Overrides ProcessPluginBase::transform

File

core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php, line 19

Class

TimeZone
Process the D6 Timezone offset into a D8 compatible timezone name.

Namespace

Drupal\system\Plugin\migrate\process\d6

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $offset = $value;
    // Convert the integer value of the offset (which can be either
    // negative or positive) to a timezone name.
    // Note: Daylight saving time is not to be used.
    $timezone_name = timezone_name_from_abbr('', intval($offset), 0);
    if (!$timezone_name) {
        $timezone_name = 'UTC';
    }
    return $timezone_name;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal