本範例為「日期示範」
FORM_預設值:
//設定「start_date」欄位預設值 $start_date=(!isset($DBV['start_date']))?"":date("Y-m-d",xoops_getUserTimestamp($DBV['start_date'])); //設定「end_date」欄位預設值 $end_date=(!isset($DBV['end_date']))?"":date("Y-m-d",xoops_getUserTimestamp($DBV['end_date']));
INSERT_寫入資料庫:
# -------- 處理時間(日期格式->時間戳記) -------------------------------------- $_POST['start_date']=userTimeToServerTime(strtotime($_POST['start_date'])); $_POST['end_date']=userTimeToServerTime(strtotime($_POST['end_date'])); # -------------------------------------------------------------------------
LIST_從資料庫撈出:
# -------- 處理時間(時間戳記->日期格式) ------------------------------------- $start_date=date("Y-m-d",xoops_getUserTimestamp($start_date)); $end_date=date("Y-m-d",xoops_getUserTimestamp($end_date)); # ---------------------------------------------------------------------------