title: PHP add 24 hours to a specific date
body: <p>I need to add 24 hours to a date that will be stored in a variable.</p>
  
  <p>Example:</p>
  
  <p><code>$date = "2019-11-20 05:05:00"; =&gt; $date = "2019-11-21 05:05:00";</code> (24 hours have been added).</p>
  
  <p>I've tried some options, but I haven't been successful in any of them.</p>
  
  <p>I have tried with <code>strtotime()</code> method:</p>
  
  <pre><code>$new_time = date("Y-m-d H:i:s", strtotime('+24 hours')).
  </code></pre>
  
  <p>If the sintaxe is like above, then it works, but it doesn't seem to accept a pre-defined date or a variable, like this:</p>
  
  <pre><code>$date = "2019-11-20 05:05:00";
  $new_time = date($date, strtotime('+24 hours'));
  </code></pre>
  
  <p>Or this:</p>
  
  <pre><code>$new_time = date("2019-11-20 05:05:00", strtotime('+24 hours'));
  </code></pre>
  
  <p>In both cases the output is the same as the input date, without the +24 being added.</p>
  
  <p>I've experimented the <code>modify()</code> method. </p>
  
  <pre><code>$date = "2019-11-20 05:05:00";
  
  $dateTime= new DateTime($date);
  $dateTime-&gt;modify('+24 hours');
  
  print_r($dateTime);
  
  echo $datetime-&gt;date;
  </code></pre>
  
  <p>Output (if I print the objetct):</p>
  
  <pre><code>DateTime Object
  (
      [date] =&gt; 2019-11-21 05:05:00.000000
      [timezone_type] =&gt; 3
      [timezone] =&gt; Europe/Paris
  )
  
  2019-11-21 05:05:00.000000
  </code></pre>
  
  <p>Output (if I don't print the objetct):</p>
  
  <pre><code>Notice:  Undefined property: DateTime::$date
  </code></pre>
  
  <p>It sort of works, but the problem is that I can access the date property only if I print the whole <code>dateTime object</code>, what would trouble my application. Besides that, apparently, these properties don't really exist, they seem to be more like a bug, since they are not described in the documentation as properties of the <code>dateTime object</code>.</p>
  
  <p>I am trying to use <code>getTimestamp()</code>, but I couldn't add time to it.</p>
  
  <p>How could I do that?</p>