IF , Else & Date Question


#1

Hi everyone,
I’m trying to create a code that would only be valid on a specific day and after that date, a different code is shown.
For example, if the date is Thursday, then form A is shown to the visitor; however, if the date is Friday, then from B is shown.

Can I do this with an If & Else snippet by using the date function?

Thanks!


#2

I use to do this all the time for clients that had events or promotions. So, the short answer is yes.


#3

Simple:

if (date('w')==0 {
    //  Day of week is Sunday  display Sunday data...
} elseif (date('w')==4) {
   //  Day of week is Thursday, etc...
}

‘w’ is weekday as 0 to 6