Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
現在の日付 (禁止日とも呼ばれます) と禁止期間 (24 時間から 50000 時間など) をテーブルに保存しています。
有効期限を与えるには、禁止の日付に禁止の長さを追加する必要がありますが、これを行う方法について苦労しています. 日付形式を使用して時間数を追加してさまざまな方法を試しましたが、これについて頭を悩ませているようには見えません。
ありがとう。
禁止の開始日が変数に保存されており、数値のみ$startDateの変数で禁止の時間を取得している$hoursBan場合、次のようにして有効期限を取得します。
$startDate
$hoursBan
$expiryDate = strtotime( date("Y-m-d", strtotime($startDate)) . " +" . $hoursBan . " hours");