你好,我想建立將字符串轉換爲日期php
我從窗體xxx獲得$ date和$ date1。我想讓假期計劃。
現在我想處理$日期與值xx-xx-xxxx(日/月/年)的變量字符串和 $ date1現在我想將它們轉換爲日期。
我已經知道如何使用DATEDIFF()
我轉換$日期,這樣我就可以使用DATEADD數天()函數
下面的代碼
$t1 = substr($date,0,2);
$b1 = substr($date,3,2);
$y1 = substr($date,6,4);
$t2 = substr($date11,0,2);
$b2 = substr($date1,3,2);
$y2 = substr($date1,6,4);
$tawal ="$y1-$b1-$t1";
$takhir = "$y2-$b2-$t2";
$query = "SELECT datediff('$takhir', '$tawal')as selisih";
$hasil = mysql_query($query);
$data = mysql_fetch_array($hasil);
$times = $data['selisih'];
$times = + 1;
的圖片瀏覽