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.
$date = '2012-07-25 00:05'; $delay = '25';
$delay を $date に追加する簡単な方法はありますか? 結果は「2012-07-25 00:30」でなければなりません。
1 つの方法を次に示します。
$new_date = date("Y-m-d H:i", strtotime($date . " +" . $delay . " minutes"));
ここに別のものがあります:
$date = new DateTime($date); $date->add(new DateInterval('P'.$delay.'i')); $new_date = $date->format('Y-m-d H:i')