如何在PHP中添加格式化日期

this is what I have got:

$_SESSION["chosen_exam_start_time"] = new DateTime();
$schedule_date =  $_SESSION["chosen_exam_start_time"]; 
$schedule_date->setTimeZone(new DateTimeZone('Europe/London'));
$triggerOn =  $schedule_date->format('Y-m-d H:i:s');

so I have a date passed within the session called "chosen_exam_start_time".

Now what I am struggling to do is add on $triggerOn.

So currently if I do

die(var_dump($triggerOn));

I get :

string(19) "2016-03-28 17:17:57"

What I want to do is if I have another variable which tells me a value like 10, how would I be able to add that value on to the $triggerOn. So that it will be:

string(19) "2016-03-28 17:27:57"

What I have done up to now is :

            $_SESSION["chosen_exam_start_time"] = new DateTime();
            $schedule_date =  $_SESSION["chosen_exam_start_time"]; 
            $schedule_date->setTimeZone(new DateTimeZone('Europe/London'));
            $triggerOn =  $schedule_date->format('Y-m-d H:i:s');
            $value = 10;

            $triggerOn->modify((int) $value.' minute');


            die(var_dump($triggerOn));

However this die is not printing anything out now

I doesn't make sense to make any sort of calculation using strings. Just imagine you had this:

$price = 'Thirty five point nine';
$discount = 'Twenty percent';

... and you wanted to apply the discount ;-)

If your current architecture makes it impossible to keep the original DateTime object (I don't know, I don't have enough information for that) you'd better create a new one:

<?php

$triggerOn = '2016-03-28 17:17:57';
$minutes_to_add = 10;

$triggerOnDateTime = new DateTime($triggerOn, new DateTimeZone('Europe/London'));
$triggerOnDateTime->modify( sprintf('%d minutes', $minutes_to_add) );
$triggerOn = $triggerOnDateTime->format('Y-m-d H:i:s');

You are looking for the modify function on a datetime object.

$trigger->modify((int) $value.' minute');

Note I just pulled this from the Carbon Library, which is a very useful wrapper for DateTime giving you a good bit of syntactic sugar such as:

$trigger->addMinutes(10);