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 }