title: How to dynamically set an expiry-time for a button using PHP and jQuery?
body: <p>I have buttons that says <code>Accept</code> and should be valid only for <code>72 HOURS</code> from the time of creation, and past 72, it should get disabled automatically with a message in <code>&lt;span&gt;</code>.</p>
  
  <p>PHP:</p>
  
  <p>These are my time collecting variables</p>
  
  <pre><code>$original_datetime = new DateTime($_item['updated_at']);
  $expire_time = $original_datetime-&gt;modify("+72 hours");
  </code></pre>
  
  <p>HTML: </p>
  
  <pre><code>&lt;input type="button" id="acceptBtn" value="&lt;?php echo $this-&gt;__('Accept') ?&gt;" 
  data-created-at="&lt;?php echo $original_datetime-&gt;format("d-M-Y H:i:s"); ?&gt;" 
  data-expiring-at="&lt;?php echo $expire_time-&gt;format("d-M-Y H:i:s"); ?&gt;" &gt;&lt;br&gt;
  &lt;span id="expired_message"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>jQuery</p>
  
  <pre><code>jQuery(document).ready(function ($) {
      disableAcceptButton();
  }
  function disableAcceptButton() {
      setTimeout(function () {
          jQuery("#acceptBtn").prop("disabled", true).hide();
          jQuery("#expired_message").text('Sorry, time expired, if you wish to buy/sell this Product again, Contact Admin via Email');
      }, 10000);
  }
  </code></pre>
  
  <p>Instead of <code>10000</code> i.e 10 seconds, this should expire 3 days from creation.</p>
  
  <p>Help.</p>