我已經制作了一個表單,用戶可以從一個calander中選擇一個日期。它將返回d/m/Y
,14,15/2013。根據用戶輸入的日期計算星期六
我需要的是跟進週六日期14/05/2013會有什麼18/05/2013
日期字段稱爲:$_POST['field_3']
我一直strtotime
,但掙扎沒有更迭
我已經做了SOFAR:
<?php
$today = $_POST['field_3'];
$date = strtotime('d/m/Y','next Saturday', $today);
$initialString = date('m/d/Y', $date);
$end = date('m/d/Y', strtotime('next saturday 11:59 pm', $date));
echo $today ."<br>";
echo $initialString . ' - ' . $end;
?>
返回:
14/05/2013
01/01/1970 - 1970年1月3日
注意'strtotime'最多隻有2個參數。 – Boaz