LoginSignup
104

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 "ターゲット日付は未来です";
}

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
What you can do with signing up
104