Philip Meissner
Philip Meissner

Reputation: 163

PHP - Date based on the number of the day minus 2 - N

I have the a day of the week saved as a number N for the customer in the database. e.g. Sunday = 0, Monday = 1, Tuesday = 2 etc.

I would like to have a statement that can tell if it's 2 days before that day.

For instance if…

customer day = 0 and today is 5 = true

customer day = 5 and today is 3 = true

customer day = 1 and today is 6 = true

Upvotes: 0

Views: 101

Answers (1)

RiaD
RiaD

Reputation: 47620

if(($today+2)%7 == $customer)//ok

Upvotes: 2

Related Questions