title: Add minutes to time based on current time
body: <p>I am trying to figure out a way to change a value based on current time, currently I am using the following code to add certain minutes the time the order is placed.</p>
  <pre><code>$job_description = 'Order '.$order_id;
  $order_created = $order-&gt;get_date_created()-&gt;format ('Y-m-d H:i:s');
  
  $minutes_to_add = 170;
  $order_created_obj = new DateTime($order_created);
  $order_created_obj-&gt;add(new DateInterval('PT' . $minutes_to_add . 'M'));
  $job_pickup_datetime = $order_created_obj-&gt;format('Y-m-d H:i:s');
  
  $minutes_to_add = 240;
  $order_created_obj = new DateTime($order_created);
  $order_created_obj-&gt;add(new DateInterval('PT' . $minutes_to_add . 'M'));
  $job_delivery_datetime = $order_created_obj-&gt;format('Y-m-d H:i:s');
  </code></pre>
  <p>which is working fine (except for $minutes_to_add = 170 is only adding only 30 minutes to the current time for some reason but I am living with it)
  BUT then I found a need to change the $minutes_to_add value to different value based on the current time (or mainly the time of order, I wrote the following code and tested on WooCommerce but it is giving critical error and not passing the order details.</p>
  <pre><code>// Pickup time
  
  $current_time = get_current_time()-&gt;format ('H:i:s');
  
  if ($current_time &gt;= '14:30:00' &amp;&amp; $current_time &lt;= '17:00:00') {
      $minutes_to_add = 100;
  } elseif ($current_time &gt;= '17:00:00' &amp;&amp; $current_time &lt; '18:00:00'){
      $minutes_to_add = 250;
  } elseif ($current_time &gt;= '18:00:00' &amp;&amp; $current_time &lt; '19:00:00'){
      $minutes_to_add = 300;
  } else {
      $minutes_to_add = 170;
  }
      
  $order_created_obj = new DateTime($order_created);
  $order_created_obj-&gt;add(new DateInterval('PT' . $minutes_to_add . 'M'));
  $job_pickup_datetime = $order_created_obj-&gt;format('Y-m-d H:i:s');
  
  
  // delivery time
  
  $current_time = get_current_time()-&gt;format ('H:i:s');
  
  if ($current_time &gt;= '14:30:00' &amp;&amp; $current_time &lt;= '17:00:00') {
      $minutes_to_add = 130;
  } elseif ($current_time &gt;= '17:00:00' &amp;&amp; $current_time &lt; '18:00:00'){
      $minutes_to_add = 280;
  } elseif ($current_time &gt;= '18:00:00' &amp;&amp; $current_time &lt; '19:00:00'){
      $minutes_to_add = 330;
  } else {
      $minutes_to_add = 200;
  }
  
  $order_created_obj = new DateTime($order_created);
  $order_created_obj-&gt;add(new DateInterval('PT' . $minutes_to_add . 'M'));
  $job_delivery_datetime = $order_created_obj-&gt;format('Y-m-d H:i:s');
  </code></pre>