設定時區為台北,並以特定格式輸出當前日期時間。程式碼使用PHP的date函數,可產生如「20240101 235959」的時間序列字串。
date_default_timezone_set("Asia/Taipei");
$time_serial = date("Y/m/d").' '.date("H:i:s");
$time_serial = date("Ymd").' '.date("His");
echo $time_serial;
設定時區為台北,並以特定格式輸出當前日期時間。程式碼使用PHP的date函數,可產生如「20240101 235959」的時間序列字串。
date_default_timezone_set("Asia/Taipei");
$time_serial = date("Y/m/d").' '.date("H:i:s");
$time_serial = date("Ymd").' '.date("His");
echo $time_serial;