time interval

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
pedroz
Forum Commoner
Posts: 99
Joined: Thu Nov 03, 2005 6:21 am

time interval

Post by pedroz »

what is the best way to check this time interval?
from 8th December to 8January, every year!

if (time interval) {
// echo something;
}
pedroz
Forum Commoner
Posts: 99
Joined: Thu Nov 03, 2005 6:21 am

Re: time interval

Post by pedroz »

Being more specific

if (today = 7 december) //false
if (today = 8 dec) // true
if (today = 9 dec) // true
if (today = 10 dec) // true
...
if (today = 7 jan) // true
if (today = 8 jan) // true
if (today = 9 jan) // false
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: time interval

Post by Darhazer »

Code: Select all

<?php
$day = date('d');
$month = date('m');
if (($month == 12 && $day > 7) || ($month == 1 && $day <9)) {
...
}
Post Reply