Semantic MediaWiki and related extensions
|
Public Member Functions | |
__construct ( $calendarmodel, $year, $month=false, $day=false, $hour=false, $minute=false, $second=false, $timezone=false) | |
getDIType () | |
getCalendarModel () | |
getTimezone () | |
getPrecision () | |
getEra () | |
getYear () | |
getMonth () | |
getDay () | |
getHour () | |
getMinute () | |
getSecond () | |
getCalendarModelLiteral () | |
asDateTime () | |
getMwTimestamp ( $outputtype=TS_UNIX) | |
getForCalendarModel ( $calendarmodel) | |
getSortKey () | |
getJD () | |
getSerialization () | |
equals (SMWDataItem $di) | |
Public Member Functions inherited from SMWDataItem | |
getDIType () | |
getSortKey () | |
equals (SMWDataItem $di) | |
getSortKeyDataItem () | |
getSerialization () | |
getSha1 () | |
getHash () | |
__toString () | |
setOption ( $key, $value) | |
getOption ( $key, $default=null) | |
Static Public Member Functions | |
static | newFromDateTime (DateTime $dateTime) |
static | newFromTimestamp ( $timestamp) |
static | doUnserialize ( $serialization) |
static | newFromJD ( $jdValue, $calendarModel=null, $precision=null, $timezone=false) |
static | isLeapYear ( $year, $calendarmodel) |
static | getDayNumberForMonth ( $month, $year, $calendarmodel) |
Static Public Member Functions inherited from SMWDataItem | |
static | newFromSerialization ( $diType, $serialization) |
static | getDataItemClassNameForId ( $diType) |
Public Attributes | |
const | PREC_Y = SMW_PREC_Y |
const | PREC_YM = SMW_PREC_YM |
const | PREC_YMD = SMW_PREC_YMD |
const | PREC_YMDT = SMW_PREC_YMDT |
const | PREHISTORY = -10000 |
Public Attributes inherited from SMWDataItem | |
const | TYPE_NOTYPE = 0 |
Data item ID that can be used to indicate that no data item class is appropriate. | |
const | TYPE_NUMBER = 1 |
Data item ID for SMWDINumber. | |
const | TYPE_BLOB = 2 |
Data item ID for SMWDIBlob. | |
const | TYPE_BOOLEAN = 4 |
Data item ID for SMWDIBoolean. | |
const | TYPE_URI = 5 |
Data item ID for SMWDIUri. | |
const | TYPE_TIME = 6 |
Data item ID for SMWDITimePoint. | |
const | TYPE_GEO = 7 |
Data item ID for SMWDIGeoCoord. | |
const | TYPE_CONTAINER = 8 |
Data item ID for SMWDIContainer. | |
const | TYPE_WIKIPAGE = 9 |
Data item ID for SMWDIWikiPage. | |
const | TYPE_CONCEPT = 10 |
Data item ID for SMWDIConcept. | |
const | TYPE_PROPERTY = 11 |
Data item ID for SMWDIProperty. | |
const | TYPE_ERROR = 12 |
Data item ID for SMWDIError. | |
Public Attributes inherited from SMW\DataValues\Time\CalendarModel | |
const | CM_GREGORIAN = 1 |
const | CM_JULIAN = 2 |
Protected Attributes | |
$m_precision | |
$m_model | |
$m_year | |
$m_month | |
$m_day | |
$m_hours | |
$m_minutes | |
$m_seconds | |
$timezone | |
$era = null | |
$julianDay = null | |
Static Protected Attributes | |
static | $m_daysofmonths = [ 1 => 31 |
This class implements time data items. Such data items represent a unique point in time, given in either Julian or Gregorian notation (possibly proleptic), and a precision setting that states which of the components year, month, day, time were specified expicitly. Even when not specified, the data item always assumes default values for the missing parts, so the item really captures one point in time, no intervals. Times are always assumed to be in UTC.
"Y0K issue": Neither the Gregorian nor the Julian calendar assume a year 0, i.e. the year 1 BC(E) was followed by 1 AD/CE. See http://en.wikipedia.org/wiki/Year_zero This implementation adheres to this convention and disallows year 0. The stored year numbers use positive numbers for CE and negative numbers for BCE. This is not just relevant for the question of how many years have (exactly) passed since a given date, but also for the location of leap years.
SMWDITime::__construct | ( | $calendarmodel, | |
$year, | |||
$month = false , |
|||
$day = false , |
|||
$hour = false , |
|||
$minute = false , |
|||
$second = false , |
|||
$timezone = false |
|||
) |
Create a time data item. All time components other than the year can be false to indicate that they are not specified. This will affect the internal precision setting. The missing values are initialised to minimal values (0 or 1) for internal calculations.
$calendarmodel | integer one of SMWDITime::CM_GREGORIAN or SMWDITime::CM_JULIAN | |
$year | integer number of the year (possibly negative) | |
$month | mixed integer number or false | |
$day | mixed integer number or false | |
$hour | mixed integer number or false | |
$minute | mixed integer number or false | |
$second | mixed integer number or false | |
integer | false | $timezone |
SMWDITime::asDateTime | ( | ) |
|
static |
Create a data item from the provided serialization string.
SMWDITime::getCalendarModel | ( | ) |
SMWDITime::getCalendarModelLiteral | ( | ) |
SMWDITime::getDay | ( | ) |
|
static |
Find out how many days the given month had in the given year based on the specified calendar model. This calculation assumes that neither calendar has a year 0.
$month | integer month number |
$year | integer year number |
$calendarmodel | integer either SMWDITime::CM_GREGORIAN or SMWDITime::CM_JULIAN |
SMWDITime::getDIType | ( | ) |
SMWDITime::getEra | ( | ) |
Indicates whether a user explicitly used an era marker even for a positive year.
SMWDITime::getForCalendarModel | ( | $calendarmodel | ) |
Get the data in the specified calendar model. This might require conversion.
$calendarmodel | integer one of SMWDITime::CM_GREGORIAN or SMWDITime::CM_JULIAN |
SMWDITime::getHour | ( | ) |
SMWDITime::getJD | ( | ) |
SMWDITime::getMinute | ( | ) |
SMWDITime::getMonth | ( | ) |
SMWDITime::getMwTimestamp | ( | $outputtype = TS_UNIX | ) |
Returns a MW timestamp representation of the value.
$outputtype |
SMWDITime::getPrecision | ( | ) |
SMWDITime::getSecond | ( | ) |
SMWDITime::getSerialization | ( | ) |
SMWDITime::getSortKey | ( | ) |
Return a number that helps comparing time data items. For dates in the Julian Day era (roughly from 4713 BCE onwards), we use the Julian Day number. For earlier dates, the (negative) year number with a fraction for the date is used (times are ignored). This avoids calculation errors that would occur for very ancient dates if the JD number was used there.
SMWDITime::getTimezone | ( | ) |
SMWDITime::getYear | ( | ) |
|
static |
Find out whether the given year number is a leap year. This calculation assumes that neither calendar has a year 0.
$year | integer year number |
$calendarmodel | integer either SMWDITime::CM_GREGORIAN or SMWDITime::CM_JULIAN |
|
static |
DateTime | $dateTime |
DataItemException |
|
static |
Create a new time dataItem from a specified Julian Day number, calendar model, presicion.
double | $jdValue | |
integer | null | $calendarmodel | |
integer | null | $precision |
|
static |
Creates and returns a new instance of SMWDITime from a MW timestamp.
string | $timestamp | must be in format |
const SMWDITime::PREHISTORY = -10000 |
The year before which we do not accept anything but year numbers and largely discourage calendar models.