class DatexGregorian in Datex 7.2
Default Gregorian for datex.
Hierarchy
- interface \DatexCalendarIterface
- class \DatexGregorian
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DatexCalendarIterface:: |
function | Helper function to make up for missing granularities. | 1 | |
DatexGregorian:: |
public | function |
To override format charachters DatexObject can't or shouldn't handle. Overrides DatexCalendarIterface:: |
|
DatexGregorian:: |
public static | function |
Methos responsible for converting Gregorian date to localized date. Overrides DatexCalendarIterface:: |
|
DatexGregorian:: |
public static | function |
Day of week calculated from given year and day of year. Overrides DatexCalendarIterface:: |
|
DatexGregorian:: |
public | function | ||
DatexGregorian:: |
public | function | ||
DatexGregorian:: |
public | function |
Returns various information used by DatexObject. Overrides DatexCalendarIterface:: |
|
DatexGregorian:: |
public | function |
Provides an array containing default arguments for INTL formatter. Overrides DatexCalendarIterface:: |
|
DatexGregorian:: |
public static | function |
Will calculate whether the localized year is leap year or not. Overrides DatexCalendarIterface:: |
|
DatexGregorian:: |
public | function | ||
DatexGregorian:: |
public | function | ||
DatexGregorian:: |
public static | function |
Opposite of DatexCalendarIterface::convert(). Overrides DatexCalendarIterface:: |