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.
こんにちは、助けてくれてありがとう。私は mysql に 2 つの列 (date1)、(date2) を持つテーブルを持っています。これら 2 日間の間の日を見つけ、php を使用して毎日 10 ドルの価格を計算したいと考えています。
どうぞ:
$dt1 = new DateTime("@{$date1}"); $dt2 = new DateTime("@{$date2}"); $interval = $dt1->diff($dt2); $price = 10 * $interval->d;
$date1これは、日付を$date2UNIXタイムスタンプとして保存していることを前提としています
$date1
$date2