LoginSignup
104
105

More than 5 years have passed since last update.

【PHP】日付比較

Last updated at Posted at 2014-07-12

いつも忘れちゃうのでメモ。

date.php
$today = date("Y/m/d");
$target_day = "2014/06/10";
if(strtotime($today) === strtotime($target_day)){
  echo "ターゲット日付は今日です";
}else if(strtotime($today) > strtotime($target_day)){
  echo "ターゲット日付は過去です";
}else{
  echo "ターゲット日付は未来です";
}
104
105
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
104
105