Posted by Chung Leong on 10/21/67 11:34
Mike wrote:
> I wrote:"I dont understand what the $yesterday and $day_secs are for?"
> What do those 2 variables have to do with creating the calendar???
> This is why I refered to the book.
The conversions to Unix timestamp is done presumbly so to make it
easier to determine whether the days shown are in the past or in the
future. Instead of comparing three numbers--the year, the month, and
the day--you compare just one. The strategy just ends up complicating
the code. It'd easy enough to do this:
if($year < $today_year || $month < $today_month || $day < $today_day) {
/* days in the past */
}
else if($year > $today_year || $month > $today_month || $day >
$today_day) {
/* days in the future */
}
else {
/* today */
}
Navigation:
[Reply to this message]
|