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.
div年を除く日付の範囲を表示するにはどうすればよいですか
div
例:
//check today $today = date('d-m'); $start_date = '01-04'; $end_date = '30-04'; if ( $start_date > $today && $end_date < $today ) { echo 'OK'; } else { echo 'NONE'; }
PHPでそれを行うための最良の解決策は何ですか?
「mm-dd」の形式で日付を表現してみてください。そう
$today = date('m-d'); $start = '04-01'; $end = '04-30'; if ($start <= $today && $end >= $today) { // Today's date lies between the start and end dates }