1
votes

I need to display info(a div) ONLY during specific date ranges. Everything I Google only comes up with a single month or day. Not the range needed.

date ranges:

Q1 December 21st(year before) to Jan 31st
Q2 March 21st to April 28th
Q3 June 21st to July 31st
Q4 September 21st to October 31st

Q1 Feb 1st to March 20th
Q2 May 1st to June 20th
Q3 August 1st to September 20th
Q4 November 20th to December 20th

Annual
December 21st (year before) to January 31st (current year)

1

1 Answers

2
votes

Substitute dates as you please.

    $now = new \DateTime();
    if (new \DateTime('2013-12-21') <= $now && $now < new \DateTime('2014-01-31')) {
        echo "<div>It is Q1</div>";
    }