How to subtract the node getChangedTime from 1 year I created a field that display a nodes last changed date using hook_form alter like this.

function demo3_form_alter(&amp;$form, $form_state, $form_id) {
  if($form_id == 'node_page_edit_form') {
   $node = $form_state-&gt;getFormObject()-&gt;getEntity();
   $form['field_message'] = array(
     '#type' =&gt; 'item',
     '#title' =&gt; t('Changed date'),
     '#markup' =&gt; format_date($node-&gt;getChangedTime(), 'medium'),
   );
}


I need to create a new field underneath it for the Review date. This field needs to subtract the getChangedTime from a period of 1 year or 365 days. So if the changed date was 30 days ago. The Review date will be 335 days and display in a medium format.
Going under the assumption that this is Drupal 8 (based on the $node = $form_state-&gt;getFormObject()-&gt;getEntity(); line, you can do something like this:

function demo3_form_alter(&amp;$form, $form_state, $form_id) {
  if ($form_id == 'node_page_edit_form') {
    /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
    $date_formatter = \Drupal::service('date.formatter');

    $node = $form_state-&gt;getFormObject()-&gt;getEntity();
    $changed = $node-&gt;getChangedTime();
    $review = new \DateTime();
    $review-&gt;setTimestamp($changed);
    $review-&gt;modify('+1 year');

    $form['field_message'] = array(
      '#type' =&gt; 'item',
      '#title' =&gt; t('Changed date'),
      '#plain_text' =&gt; $date_formatter-&gt;format($changed, 'medium'),
    );

    $form['field_review'] = array(
      '#type' =&gt; 'item',
      '#title' =&gt; t('Review date'),
      '#plain_text' =&gt; $date_formatter-&gt;format($review-&gt;getTimestamp(), 'medium'),
    );
  }
}


Your other option is to use the timeago methods on DateFormatterInterface.