PHP/MySQL を使用してイベント システムを作成しており、PHP を使用して日付をつなぎ合わせて文字列を形成しています。日付を dd-mm-yy の形式にしたい。私は次のコードを使用しています:
 $title = $_POST['title'];
         $title = htmlspecialchars($title);
         $type = $_POST['evtype'];
         $type = htmlspecialchars($type);
         $evdesc = $_POST['evdesc'];
         $evdesc = htmlspecialchars($evdesc);
         $startdate = ( isset( $_POST['startdate'] ) ) ? $_POST['startdate'] : '' ;
         $starttime = $_POST['starttime'];
         $starttime = htmlspecialchars($starttime);
         $enddate = ( isset( $_POST['enddate'] ) ) ? $_POST['enddate'] : '' ;
         $endtime = $_POST['endtime'];
         $endtime = htmlspecialchars($endtime);
         $location = $_POST['location'];
         $location = htmlspecialchars($location);
 // assemble dates and times
list($startday, $startmonth, $startyear) = array_pad(explode('-', $startdate, 2), 2, null);
$evstart = '' . $startyear . '-' . $startmonth . '-' . $startday . ' ' . $starttime . '';
list($endday, $endmonth, $endyear) = array_pad(explode('-', $enddate, 2), 2, null); // explode("-", $enddate);
$evend = '' . $endyear . '-' . $endmonth . '-' . $endday . ' ' . $endtime . '';
         // end assemble
ただし、このコードはデータを展開せず、後でデータベースにポストするのは「-- (time here)」だけです。
エラーは次のとおりです。
注意: 未定義のオフセット: 42 行目の calendar.php の 2
注意: 未定義のオフセット: 45 行目の calendar.php の 2