Пример #1
0
 /**
  * @param TimeZone $timeZone
  *
  * @return DayOfWeek
  */
 public static function now(TimeZone $timeZone)
 {
     return LocalDate::now($timeZone)->getDayOfWeek();
 }
Пример #2
0
 /**
  * Returns the current year-month in the given time-zone.
  *
  * @param TimeZone $timeZone
  *
  * @return YearMonth
  */
 public static function now(TimeZone $timeZone)
 {
     $localDate = LocalDate::now($timeZone);
     return new YearMonth($localDate->getYear(), $localDate->getMonth());
 }
Пример #3
0
 /**
  * Returns the current month-day.
  *
  * @param TimeZone $timeZone
  *
  * @return MonthDay
  */
 public static function now(TimeZone $timeZone)
 {
     $date = LocalDate::now($timeZone);
     return new MonthDay($date->getMonth(), $date->getDay());
 }
Пример #4
0
 /**
  * @dataProvider providerNow
  *
  * @param integer $epochSecond The epoch second to set the clock to.
  * @param string  $timeZone    The time-zone to get the date in.
  * @param integer $year        The expected year.
  * @param integer $month       The expected month.
  * @param integer $day         The expected day.
  */
 public function testNow($epochSecond, $timeZone, $year, $month, $day)
 {
     $this->setClockTime($epochSecond);
     $this->assertLocalDateIs($year, $month, $day, LocalDate::now(TimeZone::parse($timeZone)));
 }
Пример #5
0
 /**
  * @param TimeZone $timeZone
  *
  * @return Year
  */
 public static function now(TimeZone $timeZone)
 {
     return new Year(LocalDate::now($timeZone)->getYear());
 }