Пример #1
0
 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);
             }
         }
     }
 }
Пример #2
0
 /**
  * @group datetime
  */
 public function testDayOff()
 {
     $test = new DateTime('1982-06-01');
     $this->assertFalse($test->isDayOff());
 }
Пример #3
0
 /**
  * @param \DateTimeZone|string $timezone
  * @return DateTime
  */
 public function setTimezone($timezone)
 {
     if (!$timezone instanceof \DateTimeZone) {
         $timezone = new \DateTimeZone($timezone);
     }
     parent::setTimezone($timezone);
     return $this;
 }