12-02-2008, 07:50 PM
|
#5 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
I created a calendar class for TalkPHP. Although I never released it. I should do as it's very in-depth! The function I used for detecting if it is the weekend or not, is the following:
php Code:
public function isWeekend (){ list($iDay, $iMonth, $iYear) = explode(' ', date('d m Y', $this-> m_iDate)); $szDay = date('D', mktime(0, 0, 0, $iMonth, $iDay, $iYear)); if($szDay == 'Sat' || $szDay == 'Sun') { return true; } return false; }
The member variable $this->m_iDate is nothing more than a UNIX timestamp. This can obviously be created using time()! Perhaps somebody knows of a better way, however. In which case, I would love to hear it, as I love dealing with dates.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|