/** * 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; }
/** * @dataProvider getMonthProvider * * @covers ::getMonth * * @param int $month * @param string $langCode * @param string $expS * @param string $expL */ public function test_getMonth($month, $langCode, $expS, $expL) { $this->assertSame($expS, Calendar::getMonth($month, $langCode, Calendar::STYLE_SHORT)); $this->assertSame($expL, Calendar::getMonth($month, $langCode, Calendar::STYLE_LONG)); }