public function getCoolDate($isShowTime = true) { if ($this->_date->isToday()) { return self::$_trans[self::$_language][1] . ($isShowTime ? ', ' . $this->format('H:i') : ''); } else { if ($this->_date->isYesterday()) { return self::$_trans[self::$_language][0] . ($isShowTime ? ', ' . $this->format('H:i') : ''); } else { if ($this->_date->isTomorrow()) { return self::$_trans[self::$_language][2] . ($isShowTime ? ', ' . $this->format('H:i') : ''); } else { return $this->getFullDate($isShowTime); } } } }
/** * @group datetime */ public function testDayOff() { $test = new DateTime('1982-06-01'); $this->assertFalse($test->isDayOff()); }
/** * @param \DateTimeZone|string $timezone * @return DateTime */ public function setTimezone($timezone) { if (!$timezone instanceof \DateTimeZone) { $timezone = new \DateTimeZone($timezone); } parent::setTimezone($timezone); return $this; }