可能重複:
How to calculate the difference between two dates using PHP?差之間的兩個日期和在輸入顯示它通過使用PHP
我在HTML三個輸入。其中兩個是開始日期和結束日期,第三個是找出它們之間的差異並顯示結果。
這裏是輸入:
<p><span>Start date:</span> <input type="date" required min="2012-01-01" name="start_d" id="start_d" ><span>* Format: YYYY-MM-DD</span><br></p>
<p><span>End date:</span> <input type="date" required min="2012-01-01" name="end_d" id="end_d" ><span>* Format: YYYY-MM-DD</span><br></p>
<p><span>Duration :</span><input type="text" required name="duration" id=duration" readonly="readonly"><br></p>
嘗試'的strtotime()'函數 – safarov 2012-03-24 20:48:48
一請就爲了看一看。 – yehuda 2012-03-24 20:49:17