You are here

class DatexGregorian in Datex 7.2

Default Gregorian for datex.

Hierarchy

Expanded class hierarchy of DatexGregorian

File

datex_api/DatexGregorian.inc, line 13
Gregorian for datex. Nothinf special, always calls DateTime methods to handle stuff.

View source
class DatexGregorian extends DatexCalendarIterface {
  public static function convert($timestamp) {
    $date = new DateTime('@' . $timestamp);
    return array(
      $date
        ->format('Y'),
      $date
        ->format('m'),
      $date
        ->format('n'),
      $date
        ->format('j'),
      $date
        ->format('H'),
      $date
        ->format('i'),
      $date
        ->format('s'),
      $date
        ->format('z'),
      $date
        ->format('w'),
    );
  }

  /**
   * Opposite of DatexCalendarIterface::convert().
   */
  public static function toGregorian($year = 0, $month = 0, $day = 0) {
    $date = new DateTime();
    if (!$year) {
      $year = $date
        ->format('Y');
    }
    if (!$month) {
      $month = $date
        ->format('n');
    }
    if (!$day) {
      $day = $date
        ->format('j');
    }
    return array(
      $year,
      $month,
      $day,
    );
  }
  public static function isLeap($year) {
    $date = new DateTime();
    $date
      ->setDate($year, 1, 1);
    return $date
      ->format('L');
  }
  public function getInfo($name) {
  }
  public function calendarFormat() {
    return array();
  }
  public static function dayOfWeek($year, $dayOfYear = 0) {
    return 0;
  }

  /**
   * Provides an array containing default arguments for INTL formatter.
   */
  public function getIntlArgs() {
  }
  public function fixGranularities(array $granuls) {
  }
  public function formatPHP($format) {
    return $this
      ->xformat($format);
  }
  public function setDate($y = NULL, $m = NULL, $d = NULL) {
    if ($y === NULL) {
      $y = date('Y');
    }
    if ($m === NULL) {
      $m = date('n');
    }
    if ($d === NULL) {
      $d = date('j');
    }
    $this
      ->xsetDate($y, $m, $d);
  }
  public function objectFromDate($date, $tz = NULL) {
    return $this
      ->xobjectFromDate($date, $tz);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DatexCalendarIterface::fixMissingGranularities function Helper function to make up for missing granularities. 1
DatexGregorian::calendarFormat public function To override format charachters DatexObject can't or shouldn't handle. Overrides DatexCalendarIterface::calendarFormat
DatexGregorian::convert public static function Methos responsible for converting Gregorian date to localized date. Overrides DatexCalendarIterface::convert
DatexGregorian::dayOfWeek public static function Day of week calculated from given year and day of year. Overrides DatexCalendarIterface::dayOfWeek
DatexGregorian::fixGranularities public function
DatexGregorian::formatPHP public function
DatexGregorian::getInfo public function Returns various information used by DatexObject. Overrides DatexCalendarIterface::getInfo
DatexGregorian::getIntlArgs public function Provides an array containing default arguments for INTL formatter. Overrides DatexCalendarIterface::getIntlArgs
DatexGregorian::isLeap public static function Will calculate whether the localized year is leap year or not. Overrides DatexCalendarIterface::isLeap
DatexGregorian::objectFromDate public function
DatexGregorian::setDate public function
DatexGregorian::toGregorian public static function Opposite of DatexCalendarIterface::convert(). Overrides DatexCalendarIterface::toGregorian