diff --git a/core/modules/datetime/config/schema/datetime.schema.yml b/core/modules/datetime/config/schema/datetime.schema.yml
index 0718e04..406a2fd 100644
--- a/core/modules/datetime/config/schema/datetime.schema.yml
+++ b/core/modules/datetime/config/schema/datetime.schema.yml
@@ -23,8 +23,15 @@ field.value.datetime:
       type: string
       label: 'Default date value'
 
-field.formatter.settings.datetime_default:
+field.formatter.settings.datetime_base:
   type: mapping
+  mapping:
+    timezone_override:
+      type: string
+      label: 'Time zone override'
+
+field.formatter.settings.datetime_default:
+  type: field.formatter.settings.datetime_base
   label: 'Datetime default display format settings'
   mapping:
     format_type:
@@ -32,9 +39,33 @@ field.formatter.settings.datetime_default:
       label: 'Date format'
 
 field.formatter.settings.datetime_plain:
-  type: mapping
+  type: field.formatter.settings.datetime_base
   label: 'Datetime plain display format settings'
 
+field.formatter.settings.datetime_custom:
+  type: field.formatter.settings.datetime_base
+  label: 'Datetime custom display format settings'
+  mapping:
+    date_format:
+      type: string
+      label: 'Date/time format'
+      translatable: true
+      translation context: 'PHP date format'
+
+field.formatter.settings.datetime_time_ago:
+  type: mapping
+  label: 'Datetime time ago display format settings'
+  mapping:
+    future_format:
+      type: string
+      label: 'Future format'
+    past_format:
+      type: string
+      label: 'Past format'
+    granularity:
+      type: integer
+      label: 'Granularity'
+
 field.widget.settings.datetime_datelist:
   type: mapping
   label: 'Datetime select list display format settings'
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php
new file mode 100644
index 0000000..4115c33
--- /dev/null
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeCustomFormatter.php
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeCustomFormatter.
+ */
+
+namespace Drupal\datetime\Plugin\Field\FieldFormatter;
+
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Plugin implementation of the 'Custom' formatter for 'datetime' fields.
+ *
+ * @FieldFormatter(
+ *   id = "datetime_custom",
+ *   label = @Translation("Custom"),
+ *   field_types = {
+ *     "datetime"
+ *   }
+ *)
+ */
+class DateTimeCustomFormatter extends DateTimeFormatterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultSettings() {
+    return array(
+      'date_format' => DATETIME_DATETIME_STORAGE_FORMAT,
+    ) + parent::defaultSettings();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(FieldItemListInterface $items) {
+    $elements = array();
+
+    foreach ($items as $delta => $item) {
+      $output = '';
+      if (!empty($item->date)) {
+        /** @var \Drupal\Core\Datetime\DrupalDateTime $date */
+        $date = $item->date;
+
+        if ($this->getFieldSetting('datetime_type') == 'date') {
+          // A date without time will pick up the current time, use the default.
+          datetime_date_default_time($date);
+        }
+        $this->setTimeZone($date);
+
+        $output = $date->format($this->getSetting('date_format'), $this->getFormatSettings());
+      }
+      $elements[$delta] = [
+        '#markup' => $output,
+        '#cache' => [
+          'contexts' => [
+            'timezone',
+          ],
+        ],
+      ];
+    }
+
+    return $elements;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, FormStateInterface $form_state) {
+    $form = parent::settingsForm($form, $form_state);
+
+    $form['date_format'] = array(
+      '#type' => 'textfield',
+      '#title' => $this->t('Date/time format'),
+      '#description' => $this->t('A user-defined date/time format. See the <a href="@url">PHP manual</a> for available options.', array('@url' => 'http://php.net/manual/function.date.php')),
+      '#default_value' => $this->getSetting('date_format'),
+    );
+
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = parent::settingsSummary();
+
+    $date = new DrupalDateTime();
+    $this->setTimeZone($date);
+    $summary[] = $date->format($this->getSetting('date_format'), $this->getFormatSettings());
+
+    return $summary;
+  }
+
+}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
index a7cb32a..8e85e88 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
@@ -14,11 +14,10 @@
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\Core\Field\FormatterBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
- * Plugin implementation of the 'datetime_default' formatter.
+ * Plugin implementation of the 'Default' formatter for 'datetime' fields.
  *
  * @FieldFormatter(
  *   id = "datetime_default",
@@ -28,7 +27,7 @@
  *   }
  * )
  */
-class DateTimeDefaultFormatter extends FormatterBase implements ContainerFactoryPluginInterface {
+class DateTimeDefaultFormatter extends DateTimeFormatterBase implements ContainerFactoryPluginInterface {
 
   /**
    * {@inheritdoc}
@@ -47,11 +46,11 @@ public static function defaultSettings() {
   protected $dateFormatter;
 
   /**
-   * The date storage.
+   * The date format entity storage.
    *
    * @var \Drupal\Core\Entity\EntityStorageInterface
    */
-  protected $dateStorage;
+  protected $dateFormatStorage;
 
   /**
    * Constructs a new DateTimeDefaultFormatter.
@@ -72,14 +71,14 @@ public static function defaultSettings() {
    *   Third party settings.
    * @param \Drupal\Core\Datetime\DateFormatter $date_formatter
    *   The date formatter service.
-   * @param \Drupal\Core\Entity\EntityStorageInterface $date_storage
-   *   The date storage.
+   * @param \Drupal\Core\Entity\EntityStorageInterface $date_format_storage
+   *   The date format entity storage.
    */
-  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, DateFormatter $date_formatter, EntityStorageInterface $date_storage) {
+  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, DateFormatter $date_formatter, EntityStorageInterface $date_format_storage) {
     parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
 
     $this->dateFormatter = $date_formatter;
-    $this->dateStorage = $date_storage;
+    $this->dateFormatStorage = $date_format_storage;
   }
 
   /**
@@ -103,26 +102,25 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc}
    */
   public function viewElements(FieldItemListInterface $items) {
-
     $elements = array();
 
     foreach ($items as $delta => $item) {
-
-      $formatted_date = '';
+      $output = '';
       $iso_date = '';
 
       if ($item->date) {
+        /** @var \Drupal\Core\Datetime\DrupalDateTime $date */
         $date = $item->date;
         // Create the ISO date in Universal Time.
         $iso_date = $date->format("Y-m-d\TH:i:s") . 'Z';
 
-        // The formatted output will be in local time.
-        $date->setTimeZone(timezone_open(drupal_get_user_timezone()));
         if ($this->getFieldSetting('datetime_type') == 'date') {
           // A date without time will pick up the current time, use the default.
           datetime_date_default_time($date);
         }
-        $formatted_date = $this->dateFormat($date);
+        $this->setTimeZone($date);
+
+        $output = $this->formatDate($date, $this->getFormatSettings());
       }
 
       // Display the date using theme datetime.
@@ -133,7 +131,7 @@ public function viewElements(FieldItemListInterface $items) {
           ],
         ],
         '#theme' => 'time',
-        '#text' => $formatted_date,
+        '#text' => $output,
         '#html' => FALSE,
         '#attributes' => array(
           'datetime' => $iso_date,
@@ -160,23 +158,27 @@ public function viewElements(FieldItemListInterface $items) {
    * @return string
    *   A formatted date string using the chosen format.
    */
-  function dateFormat($date) {
+  protected function formatDate($date) {
     $format_type = $this->getSetting('format_type');
-    return $this->dateFormatter->format($date->getTimestamp(), $format_type);
+    $timezone = $this->getSetting('timezone_override');
+    return $this->dateFormatter->format($date->getTimestamp(), $format_type, '', $timezone != '' ? $timezone : null);
   }
 
   /**
    * {@inheritdoc}
    */
   public function settingsForm(array $form, FormStateInterface $form_state) {
+    $form = parent::settingsForm($form, $form_state);
+
     $time = new DrupalDateTime();
     $format_types = $this->dateStorage->loadMultiple();
+    $options = [];
     foreach ($format_types as $type => $type_info) {
       $format = $this->dateFormatter->format($time->format('U'), $type);
       $options[$type] = $type_info->label() . ' (' . $format . ')';
     }
 
-    $elements['format_type'] = array(
+    $form['format_type'] = array(
       '#type' => 'select',
       '#title' => t('Date format'),
       '#description' => t("Choose a format for displaying the date. Be sure to set a format appropriate for the field, i.e. omitting time for a field that only has a date."),
@@ -184,16 +186,18 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
       '#default_value' => $this->getSetting('format_type'),
     );
 
-    return $elements;
+    return $form;
   }
 
   /**
    * {@inheritdoc}
    */
   public function settingsSummary() {
-    $summary = array();
+    $summary = parent::settingsSummary();
+
     $date = new DrupalDateTime();
-    $summary[] = t('Format: @display', array('@display' => $this->dateFormat($date, FALSE)));
+    $summary[] = t('Format: @display', array('@display' => $this->formatDate($date, $this->getFormatSettings())));
+
     return $summary;
   }
 
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
new file mode 100644
index 0000000..9016f42
--- /dev/null
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
@@ -0,0 +1,90 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase.
+ */
+
+namespace Drupal\datetime\Plugin\Field\FieldFormatter;
+
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Field\FormatterBase;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Component\Utility\SafeMarkup;
+
+/**
+ * Base class for 'DateTime Field formatter' plugin implementations.
+ */
+abstract class DateTimeFormatterBase extends FormatterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultSettings() {
+    return array(
+      'timezone_override' => '',
+    ) + parent::defaultSettings();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, FormStateInterface $form_state) {
+    $form = parent::settingsForm($form, $form_state);
+
+    $form['timezone_override'] = array(
+      '#type' => 'select',
+      '#title' => $this->t('Time zone override'),
+      '#description' => $this->t('The time zone selected here will always be used'),
+      '#options' => system_time_zones(TRUE),
+      '#default_value' => $this->getSetting('timezone_override'),
+    );
+
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = parent::settingsSummary();
+
+    $override = $this->getSetting('timezone_override');
+    if ($override != '') {
+      $replacements = array(
+        '@timezone' => $this->getSetting('timezone_override'),
+      );
+      $summary[] = ($override != '') ? $this->t('Time zone: @timezone', $replacements) : '';
+    }
+
+    return $summary;
+  }
+
+  /**
+   * Sets the current user's or overridden time zone on a DrupalDateTime object.
+   *
+   * @param \Drupal\Core\Datetime\DrupalDateTime $date
+   *   A DrupalDateTime object.
+   */
+  protected function setTimeZone(DrupalDateTime $date) {
+    $date->setTimeZone(timezone_open(drupal_get_user_timezone()));
+  }
+
+  /**
+   * Gets a settings array suitable for DrupalDateTime::format().
+   *
+   * @return array
+   *   The array of settings for the second parameter passed to
+   *   DrupalDateTime::format().
+   */
+  protected function getFormatSettings() {
+    $settings = [];
+
+    if ($this->getSetting('timezone_override') != '') {
+      $settings['timezone'] = $this->getSetting('timezone_override');
+    }
+
+    return $settings;
+  }
+
+}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php
index 3f68a7f..79e3270 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php
@@ -7,11 +7,10 @@
 
 namespace Drupal\datetime\Plugin\Field\FieldFormatter;
 
-use Drupal\Core\Field\FormatterBase;
 use Drupal\Core\Field\FieldItemListInterface;
 
 /**
- * Plugin implementation of the 'datetime_plain' formatter.
+ * Plugin implementation of the 'Plain' formatter for 'datetime' fields.
  *
  * @FieldFormatter(
  *   id = "datetime_plain",
@@ -21,30 +20,31 @@
  *   }
  *)
  */
-class DateTimePlainFormatter extends FormatterBase {
+class DateTimePlainFormatter extends DateTimeFormatterBase {
 
   /**
    * {@inheritdoc}
    */
   public function viewElements(FieldItemListInterface $items) {
-
     $elements = array();
 
     foreach ($items as $delta => $item) {
-
       $output = '';
       if (!empty($item->date)) {
-        // The date was created and verified during field_load(), so it is safe
-        // to use without further inspection.
+        /** @var \Drupal\Core\Datetime\DrupalDateTime $date */
         $date = $item->date;
-        $date->setTimeZone(timezone_open(drupal_get_user_timezone()));
-        $format = DATETIME_DATETIME_STORAGE_FORMAT;
+
         if ($this->getFieldSetting('datetime_type') == 'date') {
           // A date without time will pick up the current time, use the default.
           datetime_date_default_time($date);
           $format = DATETIME_DATE_STORAGE_FORMAT;
         }
-        $output = $date->format($format);
+        else {
+          $format = DATETIME_DATETIME_STORAGE_FORMAT;
+        }
+        $this->setTimeZone($date);
+
+        $output = $date->format($format, $this->getFormatSettings());
       }
       $elements[$delta] = [
         '#cache' => [
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeTimeAgoFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeTimeAgoFormatter.php
new file mode 100644
index 0000000..af4b113
--- /dev/null
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeTimeAgoFormatter.php
@@ -0,0 +1,198 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeTimeAgoFormatter.
+ */
+
+namespace Drupal\datetime\Plugin\Field\FieldFormatter;
+
+use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Core\Datetime\DateFormatter;
+use Drupal\Core\Datetime\DrupalDateTime;
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Field\FormatterBase;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Plugin implementation of the 'Time ago' formatter for 'datetime' fields.
+ *
+ * @FieldFormatter(
+ *   id = "datetime_time_ago",
+ *   label = @Translation("Time ago"),
+ *   field_types = {
+ *     "datetime"
+ *   }
+ * )
+ */
+class DateTimeTimeAgoFormatter extends FormatterBase implements ContainerFactoryPluginInterface {
+
+  /**
+   * The date formatter service.
+   *
+   * @var \Drupal\Core\Datetime\DateFormatter
+   */
+  protected $dateFormatter;
+
+  /**
+   * The current Request object.
+   *
+   * @var \Symfony\Component\HttpFoundation\Request
+   */
+  protected $request;
+
+  /**
+   * Constructs a DateTimeTimeAgoFormatter object.
+   *
+   * @param string $plugin_id
+   *   The plugin_id for the formatter.
+   * @param mixed $plugin_definition
+   *   The plugin implementation definition.
+   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
+   *   The definition of the field to which the formatter is associated.
+   * @param array $settings
+   *   The formatter settings.
+   * @param string $label
+   *   The formatter label display setting.
+   * @param string $view_mode
+   *   The view mode.
+   * @param array $third_party_settings
+   *   Third party settings.
+   * @param \Drupal\Core\Datetime\DateFormatter $date_formatter
+   *   The date formatter service.
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   The current request.
+   */
+  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, DateFormatter $date_formatter, Request $request) {
+    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
+
+    $this->dateFormatter = $date_formatter;
+    $this->request = $request;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultSettings() {
+    $settings = array(
+      'future_format' => '@time hence',
+      'past_format' => '@time ago',
+      'granularity' => 2,
+    ) + parent::defaultSettings();
+
+    return $settings;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
+    return new static(
+      $plugin_id,
+      $plugin_definition,
+      $configuration['field_definition'],
+      $configuration['settings'],
+      $configuration['label'],
+      $configuration['view_mode'],
+      $configuration['third_party_settings'],
+      $container->get('date.formatter'),
+      $container->get('request_stack')->getCurrentRequest()
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(FieldItemListInterface $items) {
+    $elements = array();
+
+    foreach ($items as $delta => $item) {
+      $date = $item->date;
+      $output = '';
+      if (!empty($item->date)) {
+        if ($this->getFieldSetting('datetime_type') == 'date') {
+          // A date without time will pick up the current time, use the default.
+          datetime_date_default_time($date);
+        }
+        $output = $this->formatDate($date);
+      }
+      $elements[$delta] = array('#markup' => $output);
+    }
+
+    return $elements;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, FormStateInterface $form_state) {
+    $form = parent::settingsForm($form, $form_state);
+
+    $form['future_format'] = array(
+      '#type' => 'textfield',
+      '#title' => $this->t('Future format'),
+      '#default_value' => $this->getSetting('future_format'),
+      '#description' => $this->t('The format for dates in the future. Use <em>@time</em> where you want the time to appear.'),
+    );
+
+    $form['past_format'] = array(
+      '#type' => 'textfield',
+      '#title' => $this->t('Past format'),
+      '#default_value' => $this->getSetting('past_format'),
+      '#description' => $this->t('The format for dates in the past. Use <em>@time</em> where you want the time to appear.'),
+    );
+
+    $form['granularity'] = array(
+      '#type' => 'number',
+      '#title' => 'Interval',
+      '#default_value' => $this->getSetting('granularity'),
+      '#description' => $this->t('How many time units should be shown in the formatted output.'),
+    );
+
+    return $form;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = parent::settingsSummary();
+
+    $future_date = new DrupalDateTime('1 year 1 month 1 week 1 day 1 hour 1 minute');
+    $past_date = new DrupalDateTime('-1 year -1 month -1 week -1 day -1 hour -1 minute');
+    $summary[] = t('Future date: %display', array('%display' => $this->formatDate($future_date)));
+    $summary[] = t('Past date: %display', array('%display' => $this->formatDate($past_date)));
+
+    return $summary;
+  }
+
+  /**
+   * Creates a formatted date value as a string.
+   *
+   * @todo Refactor when https://www.drupal.org/node/2456521 is committed.
+   *
+   * @param \Drupal\Core\Datetime\DrupalDateTime|object $date
+   *   A date/time object.
+   *
+   * @return string
+   *   The formatted date/time string using the past or future format setting.
+   */
+  protected function formatDate(DrupalDateTime $date) {
+    $granularity = $this->getSetting('granularity');
+    $interval = $this->request->server->get('REQUEST_TIME') - $date->getTimestamp();
+
+    if ($interval > 0) {
+      return SafeMarkup::format($this->getSetting('past_format'), ['@time' => $this->dateFormatter->formatInterval($interval, $granularity)]);
+    }
+    else {
+      // DateFormatter::formatInterval() assumes positive intervals, so negate
+      // it to force the calculation to work properly.
+      return SafeMarkup::format($this->getSetting('future_format'), ['@time' => $this->dateFormatter->formatInterval(-$interval, $granularity)]);
+    }
+  }
+
+}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
index 32d3668..dfe750e 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
@@ -43,12 +43,12 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
       $date = $items[$delta]->date;
       // The date was created and verified during field_load(), so it is safe to
       // use without further inspection.
-      $date->setTimezone(new \DateTimeZone($element['value']['#date_timezone']));
       if ($this->getFieldSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE) {
         // A date without time will pick up the current time, use the default
         // time.
         datetime_date_default_time($date);
       }
+      $date->setTimezone(new \DateTimeZone($element['value']['#date_timezone']));
       $element['value']['#default_value'] = $date;
     }
 
diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
index f3fcae1..ccfa66a 100644
--- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php
+++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\datetime\Tests;
 
+use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Entity\Entity\EntityViewDisplay;
 use Drupal\Core\Datetime\DrupalDateTime;
@@ -27,6 +28,11 @@ class DateTimeFieldTest extends WebTestBase {
   public static $modules = array('node', 'entity_test', 'datetime', 'field_ui');
 
   /**
+   * The default display settings to use for the formatters.
+   */
+  protected $defaultSettings;
+
+  /**
    * An array of display options to pass to entity_get_display()
    *
    * @var array
@@ -47,9 +53,18 @@ class DateTimeFieldTest extends WebTestBase {
    */
   protected $field;
 
+  /**
+   * {@inheritdoc}
+   */
   protected function setUp() {
     parent::setUp();
 
+    // Set an explicit site timezone, and disallow per-user timezones.
+    $this->config('system.date')
+      ->set('timezone.user.configurable', 0)
+      ->set('timezone.default', 'Asia/Tokyo')
+      ->save();
+
     $web_user = $this->drupalCreateUser(array(
       'access content',
       'view test entity',
@@ -81,10 +96,14 @@ protected function setUp() {
       ))
       ->save();
 
+    $this->defaultSettings = array(
+      'timezone_override' => '',
+    );
+
     $this->displayOptions = array(
       'type' => 'datetime_default',
       'label' => 'hidden',
-      'settings' => array('format_type' => 'medium'),
+      'settings' => array('format_type' => 'medium') + $this->defaultSettings,
     );
     entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
       ->setComponent($field_name, $this->displayOptions)
@@ -103,9 +122,17 @@ function testDateField() {
     $this->assertFieldByXPath('//*[@id="edit-' . $field_name . '-wrapper"]/h4[contains(@class, "form-required")]', TRUE, 'Required markup found');
     $this->assertNoFieldByName("{$field_name}[0][value][time]", '', 'Time element not found.');
 
-    // Submit a valid date and ensure it is accepted.
+    // Build up a date in the UTC timezone.
     $value = '2012-12-31 00:00:00';
-    $date = new DrupalDateTime($value);
+    $date = new DrupalDateTime($value, 'UTC');
+
+    // The expected values will use the default time.
+    datetime_date_default_time($date);
+
+    // Update the timezone to the system default.
+    $date->setTimezone(timezone_open(drupal_get_user_timezone()));
+
+    // Submit a valid date and ensure it is accepted.
     $date_format = entity_load('date_format', 'html_date')->getPattern();
     $time_format = entity_load('date_format', 'html_time')->getPattern();
 
@@ -119,9 +146,6 @@ function testDateField() {
     $this->assertRaw($date->format($date_format));
     $this->assertNoRaw($date->format($time_format));
 
-    // The expected values will use the default time.
-    datetime_date_default_time($date);
-
     // Verify that the date is output according to the formatter settings.
     $options = array(
       'format_type' => array('short', 'medium', 'long'),
@@ -129,7 +153,7 @@ function testDateField() {
     foreach ($options as $setting => $values) {
       foreach ($values as $new_value) {
         // Update the entity display settings.
-        $this->displayOptions['settings'] = array($setting => $new_value);
+        $this->displayOptions['settings'] = array($setting => $new_value) + $this->defaultSettings;
         entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
           ->setComponent($field_name, $this->displayOptions)
           ->save();
@@ -140,7 +164,7 @@ function testDateField() {
             // Verify that a date is displayed.
             $expected = format_date($date->getTimestamp(), $new_value);
             $this->renderTestEntity($id);
-            $this->assertText($expected, format_string('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
+            $this->assertText($expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
             break;
         }
       }
@@ -148,13 +172,65 @@ function testDateField() {
 
     // Verify that the plain formatter works.
     $this->displayOptions['type'] = 'datetime_plain';
-    $this->displayOptions['settings'] = array();
+    $this->displayOptions['settings'] = $this->defaultSettings;
     entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
       ->setComponent($field_name, $this->displayOptions)
       ->save();
     $expected = $date->format(DATETIME_DATE_STORAGE_FORMAT);
     $this->renderTestEntity($id);
-    $this->assertText($expected, format_string('Formatted date field using plain format displayed as %expected.', array('%expected' => $expected)));
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using plain format displayed as %expected.', array('%expected' => $expected)));
+
+    // Verify that the 'datetime_custom' formatter works.
+    $this->displayOptions['type'] = 'datetime_custom';
+    $this->displayOptions['settings'] = array('date_format' => 'm/d/Y') + $this->defaultSettings;
+    entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
+      ->setComponent($field_name, $this->displayOptions)
+      ->save();
+    $expected = $date->format($this->displayOptions['settings']['date_format']);
+    $this->renderTestEntity($id);
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using datetime_custom format displayed as %expected.', array('%expected' => $expected)));
+
+    // Verify that the 'datetime_time_ago' formatter works for intervals in the
+    // past.  First update the test entity so that the date difference always
+    // has the same interval.  Since the database always stores UTC, and the
+    // interval will use this, force the test date to use UTC and not the local
+    // or user timezome.
+    $entity = entity_load('entity_test', $id);
+    $field_name = $this->fieldStorage->getName();
+    $date = DrupalDateTime::createFromTimestamp(REQUEST_TIME - 87654321, 'UTC');
+    $entity->{$field_name}->value = $date->format($date_format);
+    $entity->save();
+
+    $this->displayOptions['type'] = 'datetime_time_ago';
+    $this->displayOptions['settings'] = array(
+      'future_format' => '@time in the future',
+      'past_format' => '@time in the past',
+      'granularity' => 3,
+    );
+    entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
+      ->setComponent($field_name, $this->displayOptions)
+      ->save();
+    $expected = '2 years 9 months 2 weeks in the past';
+    $this->renderTestEntity($id);
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using datetime_time_ago format displayed as %expected.', array('%expected' => $expected)));
+
+    // Verify that the 'datetime_time_ago' formatter works for intervals in the
+    // future.  First update the test entity so that the date difference always
+    // has the same interval.  Since the database always stores UTC, and the
+    // interval will use this, force the test date to use UTC and not the local
+    // or user timezome.
+    $entity = entity_load('entity_test', $id);
+    $field_name = $this->fieldStorage->getName();
+    $date = DrupalDateTime::createFromTimestamp(REQUEST_TIME + 87654321, 'UTC');
+    $entity->{$field_name}->value = $date->format($date_format);
+    $entity->save();
+
+    entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
+      ->setComponent($field_name, $this->displayOptions)
+      ->save();
+    $expected = '2 years 9 months 2 weeks in the future';
+    $this->renderTestEntity($id);
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using datetime_time_ago format displayed as %expected.', array('%expected' => $expected)));
   }
 
   /**
@@ -171,9 +247,14 @@ function testDatetimeField() {
     $this->assertFieldByName("{$field_name}[0][value][date]", '', 'Date element found.');
     $this->assertFieldByName("{$field_name}[0][value][time]", '', 'Time element found.');
 
-    // Submit a valid date and ensure it is accepted.
+    // Build up a date in the UTC timezone.
     $value = '2012-12-31 00:00:00';
-    $date = new DrupalDateTime($value);
+    $date = new DrupalDateTime($value, 'UTC');
+
+    // Update the timezone to the system default.
+    $date->setTimezone(timezone_open(drupal_get_user_timezone()));
+
+    // Submit a valid date and ensure it is accepted.
     $date_format = entity_load('date_format', 'html_date')->getPattern();
     $time_format = entity_load('date_format', 'html_time')->getPattern();
 
@@ -195,7 +276,7 @@ function testDatetimeField() {
     foreach ($options as $setting => $values) {
       foreach ($values as $new_value) {
         // Update the entity display settings.
-        $this->displayOptions['settings'] = array($setting => $new_value);
+        $this->displayOptions['settings'] = array($setting => $new_value) + $this->defaultSettings;
         entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
           ->setComponent($field_name, $this->displayOptions)
           ->save();
@@ -206,7 +287,7 @@ function testDatetimeField() {
             // Verify that a date is displayed.
             $expected = format_date($date->getTimestamp(), $new_value);
             $this->renderTestEntity($id);
-            $this->assertText($expected, format_string('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
+            $this->assertText($expected, SafeMarkup::format('Formatted date field using %value format displayed as %expected.', array('%value' => $new_value, '%expected' => $expected)));
             break;
         }
       }
@@ -214,13 +295,75 @@ function testDatetimeField() {
 
     // Verify that the plain formatter works.
     $this->displayOptions['type'] = 'datetime_plain';
-    $this->displayOptions['settings'] = array();
+    $this->displayOptions['settings'] = $this->defaultSettings;
     entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
       ->setComponent($field_name, $this->displayOptions)
       ->save();
     $expected = $date->format(DATETIME_DATETIME_STORAGE_FORMAT);
     $this->renderTestEntity($id);
-    $this->assertText($expected, format_string('Formatted date field using plain format displayed as %expected.', array('%expected' => $expected)));
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using plain format displayed as %expected.', array('%expected' => $expected)));
+
+    // Verify that the 'datetime_custom' formatter works.
+    $this->displayOptions['type'] = 'datetime_custom';
+    $this->displayOptions['settings'] = array('date_format' => 'm/d/Y g:i:s A') + $this->defaultSettings;
+    entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
+      ->setComponent($field_name, $this->displayOptions)
+      ->save();
+    $expected = $date->format($this->displayOptions['settings']['date_format']);
+    $this->renderTestEntity($id);
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using datetime_custom format displayed as %expected.', array('%expected' => $expected)));
+
+    // Verify that the 'timezone_override' setting works.
+    $this->displayOptions['type'] = 'datetime_custom';
+    $this->displayOptions['settings'] = array('date_format' => 'm/d/Y g:i:s A', 'timezone_override' => 'America/New_York') + $this->defaultSettings;
+    entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
+      ->setComponent($field_name, $this->displayOptions)
+      ->save();
+    $expected = $date->format($this->displayOptions['settings']['date_format'], array('timezone' => 'America/New_York'));
+    $this->renderTestEntity($id);
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using datetime_custom format displayed as %expected.', array('%expected' => $expected)));
+
+    // Verify that the 'datetime_time_ago' formatter works for intervals in the
+    // past.  First update the test entity so that the date difference always
+    // has the same interval.  Since the database always stores UTC, and the
+    // interval will use this, force the test date to use UTC and not the local
+    // or user timezome.
+    $entity = entity_load('entity_test', $id);
+    $field_name = $this->fieldStorage->getName();
+    $date = DrupalDateTime::createFromTimestamp(REQUEST_TIME - 87654321, 'UTC');
+    $entity->{$field_name}->value = $date->format(DATETIME_DATETIME_STORAGE_FORMAT);
+    $entity->save();
+
+    $this->displayOptions['type'] = 'datetime_time_ago';
+    $this->displayOptions['settings'] = array(
+      'future_format' => '@time from now',
+      'past_format' => '@time earlier',
+      'granularity' => 4,
+    );
+    entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
+      ->setComponent($field_name, $this->displayOptions)
+      ->save();
+    $expected = '2 years 9 months 2 weeks 12 hours earlier';
+    $this->renderTestEntity($id);
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using datetime_time_ago format displayed as %expected.', array('%expected' => $expected)));
+
+    // Verify that the 'datetime_time_ago' formatter works for intervals in the
+    // future.  First update the test entity so that the date difference always
+    // has the same interval.  Since the database always stores UTC, and the
+    // interval will use this, force the test date to use UTC and not the local
+    // or user timezome.
+    $entity = entity_load('entity_test', $id);
+    $field_name = $this->fieldStorage->getName();
+    $date = DrupalDateTime::createFromTimestamp(REQUEST_TIME + 87654321, 'UTC');
+    $entity->{$field_name}->value = $date->format(DATETIME_DATETIME_STORAGE_FORMAT);
+    $entity->save();
+
+    entity_get_display($this->field->getTargetEntityTypeId(), $this->field->getTargetBundle(), 'full')
+      ->setComponent($field_name, $this->displayOptions)
+      ->save();
+    $expected = '2 years 9 months 2 weeks 12 hours from now';
+    $this->renderTestEntity($id);
+    $this->assertText($expected, SafeMarkup::format('Formatted date field using datetime_time_ago format displayed as %expected.', array('%expected' => $expected)));
   }
 
   /**
@@ -391,7 +534,6 @@ function testDefaultValue() {
    * Test that invalid values are caught and marked as invalid.
    */
   function testInvalidField() {
-
     // Change the field to a datetime field.
     $this->fieldStorage->setSetting('datetime_type', 'datetime');
     $this->fieldStorage->save();
diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_formatter_settings.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_formatter_settings.yml
index 70d5ecb..7b70fe6 100644
--- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_formatter_settings.yml
+++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_field_formatter_settings.yml
@@ -231,14 +231,19 @@ process:
         date:
           default:
             format_type: fallback
+            timezone_override: ''
           format_interval:
             format_type: fallback
+            timezone_override: ''
           long:
             format_type: long
+            timezone_override: ''
           medium:
             format_type: medium
+            timezone_override: ''
           short:
             format_type: short
+            timezone_override: ''
         text:
           trimmed:
             trim_length: 600
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php
index eb26f9c..7780b2c 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateFieldFormatterSettingsTest.php
@@ -196,9 +196,10 @@ public function testEntityDisplaySettings() {
     $this->assertIdentical($expected, $component);
 
     // Test date field.
+    $defaults = array('format_type' => 'fallback', 'timezone_override' => '',);
     $expected['weight'] = 10;
     $expected['type'] = 'datetime_default';
-    $expected['settings'] = array('format_type' => 'fallback');
+    $expected['settings'] = array('format_type' => 'fallback') + $defaults;
     $component = $display->getComponent('field_test_date');
     $this->assertIdentical($expected, $component);
     $display = entity_load('entity_view_display', 'node.story.default');
@@ -212,13 +213,13 @@ public function testEntityDisplaySettings() {
     $component = $display->getComponent('field_test_datestamp');
     $this->assertIdentical($expected, $component);
     $display = entity_load('entity_view_display', 'node.story.teaser');
-    $expected['settings'] = array('format_type' => 'medium');
+    $expected['settings'] = array('format_type' => 'medium') + $defaults;
     $component = $display->getComponent('field_test_datestamp');
     $this->assertIdentical($expected, $component);
 
     // Test datetime field.
     $expected['weight'] = 12;
-    $expected['settings'] = array('format_type' => 'short');
+    $expected['settings'] = array('format_type' => 'short') + $defaults;
     $component = $display->getComponent('field_test_datetime');
     $this->assertIdentical($expected, $component);
     $display = entity_load('entity_view_display', 'node.story.default');
