0
嗨即時嘗試使時間考勤基於時間表,如果不是代碼將阻止我,即時通訊這樣想?PHP通過時間塊插入延遲
date_default_timezone_set('Asia/Hong_Kong');
$now = new DateTime();
$mysched = new DateTime("16:00");
// time sessions
// 7pm/19:00
if ($now -> format ("H:i") > "19:00") {
// getting my late
$deadline = DateTime::createFromFormat("H:i", "19:15");
$diff = $now->diff($deadline);
echo "You're ".$diff->i." minutes late";
}
// 4pm/16:00
else if ($now -> format ("H:i") > "16:00") {
$deadline = DateTime::createFromFormat("H:i", "16:15");
$diff = $now->diff($deadline);
echo "You're ".$diff->i." minutes late";
}
// 1pm :13:00
if ($now -> format ("H:i") > "13:00") {
$deadline = DateTime::createFromFormat("H:i", "13:15");
$diff = $now->diff($deadline);
echo "You're ".$diff->i." minutes late";
}
else {
// block if im trying to log at 1pm
}
// continue to inserting late to db....
所以問題是我在哪裏添加塊代碼片段?