Represents an astronomical Julian date, which is the number of days since noon on January 1, -4712 (4713 BC).
For increased precision, this class stores the whole number part of the date and the seconds
part of the date in separate components. In order to be safe for arithmetic and represent
leap seconds, the date is always stored in the International Atomic Time standard
TimeStandard.TAI.
| Name | Type | Default | Description |
|---|---|---|---|
julianDayNumber |
Number |
0.0
|
optional The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly. |
secondsOfDay |
Number |
0.0
|
optional The number of seconds into the current Julian Day Number. Fractional seconds, negative seconds and seconds greater than a day will be handled correctly. |
timeStandard |
TimeStandard |
TimeStandard.UTC
|
optional The time standard in which the first two parameters are defined. |
Members
-
staticCesium.JulianDate.leapSeconds : Array.<LeapSecond>
-
Gets or sets the list of leap seconds used throughout Cesium.
-
Gets or sets the number of whole days.
-
Gets or sets the number of seconds into the current day.
Methods
-
staticCesium.JulianDate.addDays(julianDate, days, result) → JulianDate
-
Adds the provided number of days to the provided date instance.
Name Type Description julianDateJulianDate The date. daysNumber The number of days to add or subtract. resultJulianDate An existing instance to use for the result. Returns:
The modified result parameter. -
staticCesium.JulianDate.addHours(julianDate, hours, result) → JulianDate
-
Adds the provided number of hours to the provided date instance.
Name Type Description julianDateJulianDate The date. hoursNumber The number of hours to add or subtract. resultJulianDate An existing instance to use for the result. Returns:
The modified result parameter. -
staticCesium.JulianDate.addMinutes(julianDate, minutes, result) → JulianDate
-
Adds the provided number of minutes to the provided date instance.
Name Type Description julianDateJulianDate The date. minutesNumber The number of minutes to add or subtract. resultJulianDate An existing instance to use for the result. Returns:
The modified result parameter. -
staticCesium.JulianDate.addSeconds(julianDate, seconds, result) → JulianDate
-
Adds the provided number of seconds to the provided date instance.
Name Type Description julianDateJulianDate The date. secondsNumber The number of seconds to add or subtract. resultJulianDate An existing instance to use for the result. Returns:
The modified result parameter. -
staticCesium.JulianDate.clone(julianDate, result) → JulianDate
-
Duplicates a JulianDate instance.
Name Type Description julianDateJulianDate The date to duplicate. resultJulianDate optional An existing instance to use for the result. Returns:
The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined. -
Compares two instances.
Name Type Description leftJulianDate The first instance. rightJulianDate The second instance. Returns:
A negative value if left is less than right, a positive value if left is greater than right, or zero if left and right are equal. -
Computes the number of seconds the provided instance is ahead of UTC.
Name Type Description julianDateJulianDate The date. Returns:
The number of seconds the provided instance is ahead of UTC -
Computes the difference in days between the provided instance.
Name Type Description leftJulianDate The first instance. rightJulianDate The second instance. Returns:
The difference, in days, when subtractingrightfromleft. -
Compares two instances and returns
trueif they are equal,falseotherwise.Name Type Description leftJulianDate optional The first instance. rightJulianDate optional The second instance. Returns:
trueif the dates are equal; otherwise,false. -
Compares two instances and returns
trueif they are withinepsilonseconds of each other. That is, in order for the dates to be considered equal (and for this function to returntrue), the absolute value of the difference between them, in seconds, must be less thanepsilon.Name Type Description leftJulianDate optional The first instance. rightJulianDate optional The second instance. epsilonNumber The maximum number of seconds that should separate the two instances. Returns:
trueif the two dates are withinepsilonseconds of each other; otherwisefalse. -
staticCesium.JulianDate.fromDate(date, result) → JulianDate
-
Creates a new instance from a JavaScript Date.
Name Type Description dateDate A JavaScript Date. resultJulianDate optional An existing instance to use for the result. Returns:
The modified result parameter or a new instance if none was provided.Throws:
-
DeveloperError : date must be a valid JavaScript Date.
-
-
staticCesium.JulianDate.fromIso8601(iso8601String, result) → JulianDate
-
Creates a new instance from a from an ISO 8601 date. This method is superior to
Date.parsebecause it will handle all valid formats defined by the ISO 8601 specification, including leap seconds and sub-millisecond times, which discarded by most JavaScript implementations.Name Type Description iso8601StringString An ISO 8601 date. resultJulianDate optional An existing instance to use for the result. Returns:
The modified result parameter or a new instance if none was provided.Throws:
-
DeveloperError : Invalid ISO 8601 date.
-
-
Compares the provided instances and returns
trueifleftis later thanright,falseotherwise.Name Type Description leftJulianDate The first instance. rightJulianDate The second instance. Returns:
trueifleftis later thanright,falseotherwise. -
Compares the provided instances and returns
trueifleftis later than or equal toright,falseotherwise.Name Type Description leftJulianDate The first instance. rightJulianDate The second instance. Returns:
trueifleftis later than or equal toright,falseotherwise. -
Compares the provided instances and returns
trueifleftis earlier thanright,falseotherwise.Name Type Description leftJulianDate The first instance. rightJulianDate The second instance. Returns:
trueifleftis earlier thanright,falseotherwise. -
Compares the provided instances and returns
trueifleftis earlier than or equal toright,falseotherwise.Name Type Description leftJulianDate The first instance. rightJulianDate The second instance. Returns:
trueifleftis earlier than or equal toright,falseotherwise. -
staticCesium.JulianDate.now(result) → JulianDate
-
Creates a new instance that represents the current system time. This is equivalent to calling
JulianDate.fromDate(new Date());.Name Type Description resultJulianDate optional An existing instance to use for the result. Returns:
The modified result parameter or a new instance if none was provided. -
Computes the difference in seconds between the provided instance.
Name Type Description leftJulianDate The first instance. rightJulianDate The second instance. Returns:
The difference, in seconds, when subtractingrightfromleft. -
Creates a JavaScript Date from the provided instance. Since JavaScript dates are only accurate to the nearest millisecond and cannot represent a leap second, consider using
JulianDate.toGregorianDateinstead. If the provided JulianDate is during a leap second, the previous second is used.Name Type Description julianDateJulianDate The date to be converted. Returns:
A new instance representing the provided date. -
staticCesium.JulianDate.toGregorianDate(julianDate, result) → GregorianDate
-
Creates a
GregorianDatefrom the provided instance.Name Type Description julianDateJulianDate The date to be converted. resultGregorianDate optional An existing instance to use for the result. Returns:
The modified result parameter or a new instance if none was provided. -
Creates an ISO8601 representation of the provided date.
Name Type Description julianDateJulianDate The date to be converted. precisionNumber optional The number of fractional digits used to represent the seconds component. By default, the most precise representation is used. Returns:
The ISO8601 representation of the provided date. -
Computes the total number of whole and fractional days represented by the provided instance.
Name Type Description julianDateJulianDate The date. Returns:
The Julian date as single floating point number. -
clone(result) → JulianDate
-
Duplicates this instance.
Name Type Description resultJulianDate optional An existing instance to use for the result. Returns:
The modified result parameter or a new instance if none was provided. -
Compares this and the provided instance and returns
trueif they are equal,falseotherwise.Name Type Description rightJulianDate optional The second instance. Returns:
trueif the dates are equal; otherwise,false. -
Compares this and the provided instance and returns
trueif they are withinepsilonseconds of each other. That is, in order for the dates to be considered equal (and for this function to returntrue), the absolute value of the difference between them, in seconds, must be less thanepsilon.Name Type Description rightJulianDate optional The second instance. epsilonNumber The maximum number of seconds that should separate the two instances. Returns:
trueif the two dates are withinepsilonseconds of each other; otherwisefalse. -
Creates a string representing this date in ISO8601 format.
Returns:
A string representing this date in ISO8601 format.
