spewn
Programmer
- May 7, 2001
- 1,034
i'm working on an event submission script.
the user submits an event and the event could be 1 day, or stretch over multiple days.
i also have an event calendar. i am able to click on a certain day and see if there is anything booked on that day.
but if an event is booked on multiple days, the event is shown on the calendar only on the first day.
if i can figure out if the date clicked on has anything booked on or through it, that would be helpful...
so far, this is what i'm working on:
i'm just getting started, and i know that every instance where the month, day or year is equal to the min or max, i'm gonna be running more conditionals. it's gonna be very intense.
is there a way to do this, easier? i found this online:
i'm not sure if i can use it.
i only have Date::Manip module installed.
thanks!
- g
the user submits an event and the event could be 1 day, or stretch over multiple days.
i also have an event calendar. i am able to click on a certain day and see if there is anything booked on that day.
but if an event is booked on multiple days, the event is shown on the calendar only on the first day.
if i can figure out if the date clicked on has anything booked on or through it, that would be helpful...
so far, this is what i'm working on:
Code:
$minDate='8/4/2007';
$date1='1/4/2008';
$maxDate='10/4/2009';
@dateVar=split(/\//,$date1);
$month1=@dateVar[0];
$day1=@dateVar[1];
$year1=@dateVar[2];
@dateVar2=split(/\//,$minDate);
$minmonth=@dateVar2[0];
$minday=@dateVar2[1];
$minyear=@dateVar2[2];
@dateVar3=split(/\//,$maxDate);
$maxmonth=@dateVar3[0];
$maxday=@dateVar3[1];
$maxyear=@dateVar3[2];
$test='is not between!';
if (($year1 >= $minyear)&&($year1 <= $maxyear)) {
if ($year1 > $minyear) {
if ($year1 < $maxyear) {
if (($month1 >= $minmonth)&&($month1 <= $maxmonth)) {
if ($month1 > $minmonth) {
if ($month1 < $maxmonth) {
if (($day1 >= $minday)&&($day1 <= $maxday)) {
if ($day1 > $minday) {
if ($day1 < $maxday) {
$test='is between';
}
else {day is equal to maxday}
}
else {day is equal to minday}
}
}
else {month is equal to maxmonth}
}
else {month is equal to minmonth}
}
}
else {year is equal to max year}
}
else {year is equal to min year}
}
is there a way to do this, easier? i found this online:
Code:
if (date.getTime() >= minDate.getTime() && date.getTime() <= maxDate.getTime()) {
throw new DateOutOfRangeException(date.toString());
}
i'm not sure if i can use it.
i only have Date::Manip module installed.
thanks!
- g