day check for if statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

day check for if statement

Post by Obadiah »

say I wanted to not allow any records to be entered after the 20th of each month and check for it in my if statement how would I go about doing that?
I know how to declare the time

Code: Select all

$time=time();
$realdate = date("m/d/y",$time);
how would I go about forming my if?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: day check for if statement

Post by Jonah Bron »

Code: Select all

if (intval(date('d', $time)) >= 20) {
    // do something
} else {
    // reject
}
Post Reply