function __construct($year_or_date = null, $month = null) { if ($year_or_date && $month) { $tmp_date = new lmbDateTime($year_or_date, $month, 1); } elseif ($year_or_date && !$month) { $tmp_date = new lmbDateTime($year_or_date); } else { $tmp_date = new lmbDateTime(); } $this->start_date = $tmp_date->getBeginOfMonth(); $this->end_date = $tmp_date->getEndOfMonth(); }
function testGetBeginOfMonth() { $date = new lmbDateTime('2005-08-20 12:24:12'); $this->assertEqual($date->getBeginOfMonth(), new lmbDateTime('2005-08-01 00:00:00')); }