Semantic MediaWiki and related extensions
Static Public Member Functions | Public Attributes | Static Protected Member Functions | List of all members
SMW\DataValues\Time\JulianDay Class Reference
Inheritance diagram for SMW\DataValues\Time\JulianDay:
Inheritance graph
[legend]
Collaboration diagram for SMW\DataValues\Time\JulianDay:
Collaboration graph
[legend]

Static Public Member Functions

static getJD ( $calendarModel, $year, $month, $day, $hour, $minute, $second)
 
static format ( $value)
 
static getModifiedJulianDate ( $jdValue)
 
static JD2Date ( $jdValue, $calendarModel=null)
 
static JD2Time ( $jdvalue)
 

Public Attributes

const J1582 = 2299160.5
 
const MJD = 2400000.5
 
- Public Attributes inherited from SMW\DataValues\Time\CalendarModel
const CM_GREGORIAN = 1
 
const CM_JULIAN = 2
 

Static Protected Member Functions

static date2JD ( $calendarmodel, $year, $month, $day)
 
static time2JDoffset ( $hours, $minutes, $seconds)
 

Detailed Description

Julian dates (abbreviated JD) are a continuous count of days and fractions since noon Universal Time on January 1, 4713 BCE (on the Julian calendar).

It is assumed that the changeover from the Julian calendar to the Gregorian calendar occurred in October of 1582.

For dates on or before 4 October 1582, the Julian calendar is used; for dates on or after 15 October 1582, the Gregorian calendar is used.

GNU GPL v2+

Since
2.4
Author
Markus Krötzsch

Member Function Documentation

◆ date2JD()

static SMW\DataValues\Time\JulianDay::date2JD (   $calendarmodel,
  $year,
  $month,
  $day 
)
staticprotected

Compute the Julian Day number from a given date in the specified calendar model. This calculation assumes that neither calendar has a year 0.

Parameters
$yearinteger representing the year
$monthinteger representing the month
$dayinteger representing the day
$calendarmodelinteger either CM_GREGORIAN or CM_JULIAN
Returns
float Julian Day number
Exceptions
RuntimeException

◆ format()

static SMW\DataValues\Time\JulianDay::format (   $value)
static

Return a formatted value

Note
April 25, 2017 20:00-4:00 is expected to be 2457869.5 and not 2457869.4999999665 hence apply the same formatting on all values to avoid some unexpected behaviour as observed in #2454
Since
3.0
Parameters
$value
Returns
float

◆ getJD()

static SMW\DataValues\Time\JulianDay::getJD (   $calendarModel,
  $year,
  $month,
  $day,
  $hour,
  $minute,
  $second 
)
static
Since
2.4
Parameters
integer$calendarmodel
integer$year
integer$month
integer$day
integer$hour
integer$minute
integer$second
Returns
float

◆ getModifiedJulianDate()

static SMW\DataValues\Time\JulianDay::getModifiedJulianDate (   $jdValue)
static

The MJD has a starting point of midnight on November 17, 1858 and is computed by MJD = JD - 2400000.5

Since
2.4
Parameters
floatjdValue
Returns
float

◆ JD2Date()

static SMW\DataValues\Time\JulianDay::JD2Date (   $jdValue,
  $calendarModel = null 
)
static

Convert a Julian Day number to a date in the given calendar model. This calculation assumes that neither calendar has a year 0.

Note
The algorithm may fail for some cases, in particular since the conversion to Gregorian needs positive JD. If this happens, wrong values will be returned. Avoid date conversions before 10000 BCE.
Parameters
$jdValuefloat number of Julian Days
$calendarModelinteger either CM_GREGORIAN or CM_JULIAN
Returns
array( calendarModel, yearnumber, monthnumber, daynumber )
Exceptions
RuntimeException

◆ JD2Time()

static SMW\DataValues\Time\JulianDay::JD2Time (   $jdvalue)
static

Extract the time from a Julian Day number and return it as a string. This conversion is the same for all calendar models.

Parameters
$jdvaluefloat number of Julian Days
Returns
array( hours, minutes, seconds )

◆ time2JDoffset()

static SMW\DataValues\Time\JulianDay::time2JDoffset (   $hours,
  $minutes,
  $seconds 
)
staticprotected

Compute the offset for the Julian Day number from a given time. This computation is the same for all calendar models.

Parameters
$hoursinteger representing the hour
$minutesinteger representing the minutes
$secondsinteger representing the seconds
Returns
float offset for a Julian Day number to get this time

Member Data Documentation

◆ J1582

const SMW\DataValues\Time\JulianDay::J1582 = 2299160.5

Moment of switchover to Gregorian calendar.

◆ MJD

const SMW\DataValues\Time\JulianDay::MJD = 2400000.5

Offset of Julian Days for Modified JD inputs.


The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy