Exemple #1
0
 /**
  * Format date as Saturday, 20 April 2013, 16:23.
  *
  * @param string $languageCode The language code ex: pl, en
  * @param bool   $timeFormat   Tho one of self::TIME_FORMAT_* constants
  *
  * @return string The formatted date
  */
 public function getLongDate($languageCode, $timeFormat = null)
 {
     if ($this->isHollow()) {
         return '';
     }
     $dayName = Calendar::getDay($this->getDayOw(), $languageCode);
     $monthName = Calendar::getMonth($this->getMonth(), $languageCode);
     $dateStr = $dayName . ', ' . $this->format('j') . ' ' . $monthName . ' ' . $this->format('Y');
     if ($timeFormat) {
         $dateStr .= ', ' . $this->format($timeFormat);
     }
     return $dateStr;
 }
Exemple #2
0
 /**
  * @dataProvider getDayProvider
  *
  * @covers ::getDay
  *
  * @param int    $dow
  * @param string $langCode
  * @param string $expS
  * @param string $expM
  * @param string $expL
  */
 public function test_getDay($dow, $langCode, $expS, $expM, $expL)
 {
     $this->assertSame($expS, Calendar::getDay($dow, $langCode, Calendar::STYLE_SHORT));
     $this->assertSame($expM, Calendar::getDay($dow, $langCode, Calendar::STYLE_MEDIUM));
     $this->assertSame($expL, Calendar::getDay($dow, $langCode, Calendar::STYLE_LONG));
 }