Class: JulianDate

JulianDate

new JulianDate(julianDayNumberopt, secondsOfDayopt, timeStandardopt)

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.
Parameters:
Name Type Attributes Default Description
julianDayNumber Number <optional>
0.0 The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly.
secondsOfDay Number <optional>
0.0 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 <optional>
TimeStandard.UTC The time standard in which the first two parameters are defined.
Source:

Members

(static) leapSeconds :Array.<LeapSecond>

Gets or sets the list of leap seconds used throughout Cesium.
Type:
Source:

dayNumber :Number

Gets or sets the number of whole days.
Type:
  • Number
Source:

secondsOfDay :Number

Gets or sets the number of seconds into the current day.
Type:
  • Number
Source:

Methods

(static) addDays(julianDate, days, result) → {JulianDate}

Adds the provided number of days to the provided date instance.
Parameters:
Name Type Description
julianDate JulianDate The date.
days Number The number of days to add or subtract.
result JulianDate An existing instance to use for the result.
Source:
Returns:
The modified result parameter.
Type
JulianDate

(static) addHours(julianDate, hours, result) → {JulianDate}

Adds the provided number of hours to the provided date instance.
Parameters:
Name Type Description
julianDate JulianDate The date.
hours Number The number of hours to add or subtract.
result JulianDate An existing instance to use for the result.
Source:
Returns:
The modified result parameter.
Type
JulianDate

(static) addMinutes(julianDate, minutes, result) → {JulianDate}

Adds the provided number of minutes to the provided date instance.
Parameters:
Name Type Description
julianDate JulianDate The date.
minutes Number The number of minutes to add or subtract.
result JulianDate An existing instance to use for the result.
Source:
Returns:
The modified result parameter.
Type
JulianDate

(static) addSeconds(julianDate, seconds, result) → {JulianDate}

Adds the provided number of seconds to the provided date instance.
Parameters:
Name Type Description
julianDate JulianDate The date.
seconds Number The number of seconds to add or subtract.
result JulianDate An existing instance to use for the result.
Source:
Returns:
The modified result parameter.
Type
JulianDate

(static) clone(julianDate, resultopt) → {JulianDate}

Duplicates a JulianDate instance.
Parameters:
Name Type Attributes Description
julianDate JulianDate The date to duplicate.
result JulianDate <optional>
An existing instance to use for the result.
Source:
Returns:
The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
Type
JulianDate

(static) compare(left, right) → {Number}

Compares two instances.
Parameters:
Name Type Description
left JulianDate The first instance.
right JulianDate The second instance.
Source:
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.
Type
Number

(static) computeTaiMinusUtc(julianDate) → {Number}

Computes the number of seconds the provided instance is ahead of UTC.
Parameters:
Name Type Description
julianDate JulianDate The date.
Source:
Returns:
The number of seconds the provided instance is ahead of UTC
Type
Number

(static) daysDifference(left, right) → {Number}

Computes the difference in days between the provided instance.
Parameters:
Name Type Description
left JulianDate The first instance.
right JulianDate The second instance.
Source:
Returns:
The difference, in days, when subtracting right from left.
Type
Number

(static) equals(leftopt, rightopt) → {Boolean}

Compares two instances and returns true if they are equal, false otherwise.
Parameters:
Name Type Attributes Description
left JulianDate <optional>
The first instance.
right JulianDate <optional>
The second instance.
Source:
Returns:
true if the dates are equal; otherwise, false.
Type
Boolean

(static) equalsEpsilon(leftopt, rightopt, epsilon) → {Boolean}

Compares two instances and returns true if they are within epsilon seconds of each other. That is, in order for the dates to be considered equal (and for this function to return true), the absolute value of the difference between them, in seconds, must be less than epsilon.
Parameters:
Name Type Attributes Description
left JulianDate <optional>
The first instance.
right JulianDate <optional>
The second instance.
epsilon Number The maximum number of seconds that should separate the two instances.
Source:
Returns:
true if the two dates are within epsilon seconds of each other; otherwise false.
Type
Boolean

(static) fromDate(date, resultopt) → {JulianDate}

Creates a new instance from a JavaScript Date.
Parameters:
Name Type Attributes Description
date Date A JavaScript Date.
result JulianDate <optional>
An existing instance to use for the result.
Source:
Throws:
date must be a valid JavaScript Date.
Type
DeveloperError
Returns:
The modified result parameter or a new instance if none was provided.
Type
JulianDate

(static) fromIso8601(iso8601String, resultopt) → {JulianDate}

Creates a new instance from a from an ISO 8601 date. This method is superior to Date.parse because 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.
Parameters:
Name Type Attributes Description
iso8601String String An ISO 8601 date.
result JulianDate <optional>
An existing instance to use for the result.
Source:
Throws:
Invalid ISO 8601 date.
Type
DeveloperError
Returns:
The modified result parameter or a new instance if none was provided.
Type
JulianDate

(static) greaterThan(left, right) → {Boolean}

Compares the provided instances and returns true if left is later than right, false otherwise.
Parameters:
Name Type Description
left JulianDate The first instance.
right JulianDate The second instance.
Source:
Returns:
true if left is later than right, false otherwise.
Type
Boolean

(static) greaterThanOrEquals(left, right) → {Boolean}

Compares the provided instances and returns true if left is later than or equal to right, false otherwise.
Parameters:
Name Type Description
left JulianDate The first instance.
right JulianDate The second instance.
Source:
Returns:
true if left is later than or equal to right, false otherwise.
Type
Boolean

(static) lessThan(left, right) → {Boolean}

Compares the provided instances and returns true if left is earlier than right, false otherwise.
Parameters:
Name Type Description
left JulianDate The first instance.
right JulianDate The second instance.
Source:
Returns:
true if left is earlier than right, false otherwise.
Type
Boolean

(static) lessThanOrEquals(left, right) → {Boolean}

Compares the provided instances and returns true if left is earlier than or equal to right, false otherwise.
Parameters:
Name Type Description
left JulianDate The first instance.
right JulianDate The second instance.
Source:
Returns:
true if left is earlier than or equal to right, false otherwise.
Type
Boolean

(static) now(resultopt) → {JulianDate}

Creates a new instance that represents the current system time. This is equivalent to calling JulianDate.fromDate(new Date());.
Parameters:
Name Type Attributes Description
result JulianDate <optional>
An existing instance to use for the result.
Source:
Returns:
The modified result parameter or a new instance if none was provided.
Type
JulianDate

(static) secondsDifference(left, right) → {Number}

Computes the difference in seconds between the provided instance.
Parameters:
Name Type Description
left JulianDate The first instance.
right JulianDate The second instance.
Source:
Returns:
The difference, in seconds, when subtracting right from left.
Type
Number

(static) toDate(julianDate) → {Date}

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.toGregorianDate instead. If the provided JulianDate is during a leap second, the previous second is used.
Parameters:
Name Type Description
julianDate JulianDate The date to be converted.
Source:
Returns:
A new instance representing the provided date.
Type
Date

(static) toGregorianDate(julianDate, resultopt) → {GregorianDate}

Creates a GregorianDate from the provided instance.
Parameters:
Name Type Attributes Description
julianDate JulianDate The date to be converted.
result GregorianDate <optional>
An existing instance to use for the result.
Source:
Returns:
The modified result parameter or a new instance if none was provided.
Type
GregorianDate

(static) toIso8601(julianDate, precisionopt) → {String}

Creates an ISO8601 representation of the provided date.
Parameters:
Name Type Attributes Description
julianDate JulianDate The date to be converted.
precision Number <optional>
The number of fractional digits used to represent the seconds component. By default, the most precise representation is used.
Source:
Returns:
The ISO8601 representation of the provided date.
Type
String

(static) totalDays(julianDate) → {Number}

Computes the total number of whole and fractional days represented by the provided instance.
Parameters:
Name Type Description
julianDate JulianDate The date.
Source:
Returns:
The Julian date as single floating point number.
Type
Number

clone(resultopt) → {JulianDate}

Duplicates this instance.
Parameters:
Name Type Attributes Description
result JulianDate <optional>
An existing instance to use for the result.
Source:
Returns:
The modified result parameter or a new instance if none was provided.
Type
JulianDate

equals(rightopt) → {Boolean}

Compares this and the provided instance and returns true if they are equal, false otherwise.
Parameters:
Name Type Attributes Description
right JulianDate <optional>
The second instance.
Source:
Returns:
true if the dates are equal; otherwise, false.
Type
Boolean

equalsEpsilon(rightopt, epsilon) → {Boolean}

Compares this and the provided instance and returns true if they are within epsilon seconds of each other. That is, in order for the dates to be considered equal (and for this function to return true), the absolute value of the difference between them, in seconds, must be less than epsilon.
Parameters:
Name Type Attributes Description
right JulianDate <optional>
The second instance.
epsilon Number The maximum number of seconds that should separate the two instances.
Source:
Returns:
true if the two dates are within epsilon seconds of each other; otherwise false.
Type
Boolean

toString() → {String}

Creates a string representing this date in ISO8601 format.
Source:
Returns:
A string representing this date in ISO8601 format.
Type
String