분류 php

PHP : 날짜가 오늘, 과거 또는 내일인지 확인

컨텐츠 정보

  • 조회 620 (작성일 )

본문

$yourdate = "2018-08-16";
if(strtotime($yourdate) < strtotime(date('Y-m-d')))
{
   echo "지난 날짜입니다.";
}
else if (strtotime($yourdate) == strtotime(date('Y-m-d'))){
  echo "오늘 날짜입니다.";
}
else if (strtotime($yourdate) > strtotime(date('Y-m-d'))){
  echo "내일 날짜입니다.";
}
php