JulianDate

表示天文儒略日期,即从公元前4713年1月1日正午起算的天数。 为了提高精度,此类将日期的整数部分和秒数部分分开存储。 为了安全进行算术运算并表示闰秒,日期始终以国际原子时标准 TimeStandard.TAI 存储。

new Cesium.JulianDate(julianDayNumber, secondsOfDay, timeStandard)

Name Type Default Description
julianDayNumber number 0.0 optional 儒略日编号,表示整天数。小数天数也会被正确处理。
secondsOfDay number 0.0 optional 当前儒略日编号中的秒数。小数秒、负秒和超过一天的秒数都会被正确处理。
timeStandard TimeStandard TimeStandard.UTC optional 定义前两个参数的时间标准。

Members

static Cesium.JulianDate.leapSeconds : Array.<LeapSecond>

Gets or sets the list of leap seconds used throughout Cesium.
获取或设置整天数。

secondsOfDay : number

获取或设置当前日期中的秒数。

Methods

static Cesium.JulianDate.addDays(julianDate, days, result)JulianDate

Adds the provided number of days to the provided date instance.
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.
Returns:
The modified result parameter.

static Cesium.JulianDate.addHours(julianDate, hours, result)JulianDate

Adds the provided number of hours to the provided date instance.
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.
Returns:
The modified result parameter.

static Cesium.JulianDate.addMinutes(julianDate, minutes, result)JulianDate

Adds the provided number of minutes to the provided date instance.
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.
Returns:
The modified result parameter.

static Cesium.JulianDate.addSeconds(julianDate, seconds, result)JulianDate

Adds the provided number of seconds to the provided date instance.
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.
Returns:
The modified result parameter.

static Cesium.JulianDate.clone(julianDate, result)JulianDate

Duplicates a JulianDate instance.
Name Type Description
julianDate JulianDate The date to duplicate.
result JulianDate 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.

static Cesium.JulianDate.compare(left, right)number

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

static Cesium.JulianDate.computeTaiMinusUtc(julianDate)number

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

static Cesium.JulianDate.daysDifference(left, right)number

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

static Cesium.JulianDate.equals(left, right)boolean

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

static Cesium.JulianDate.equalsEpsilon(left, right, 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.
Name Type Default Description
left JulianDate optional The first instance.
right JulianDate optional The second instance.
epsilon number 0 optional The maximum number of seconds that should separate the two instances.
Returns:
true if the two dates are within epsilon seconds of each other; otherwise false.

static Cesium.JulianDate.fromDate(date, result)JulianDate

从JavaScript Date创建新实例。
Name Type Description
date Date JavaScript Date对象。
result JulianDate optional 用于存储结果的现有实例。
Returns:
修改后的结果参数,如果未提供则返回新实例。
Throws:

static Cesium.JulianDate.fromGregorianDate(date, result)JulianDate

从公历日期创建新实例。
Name Type Description
date GregorianDate 公历日期。
result JulianDate optional 用于存储结果的现有实例。
Returns:
修改后的结果参数,如果未提供则返回新实例。
Throws:

static Cesium.JulianDate.fromIso8601(iso8601String, result)JulianDate

ISO 8601日期创建新实例。 此方法优于Date.parse,因为它能处理ISO 8601规范定义的所有有效格式, 包括闰秒和亚毫秒时间,而这些通常被大多数JavaScript实现丢弃。
Name Type Description
iso8601String string ISO 8601日期字符串。
result JulianDate optional 用于存储结果的现有实例。
Returns:
修改后的结果参数,如果未提供则返回新实例。
Throws:

static Cesium.JulianDate.greaterThan(left, right)boolean

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

static Cesium.JulianDate.greaterThanOrEquals(left, right)boolean

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

static Cesium.JulianDate.lessThan(left, right)boolean

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

static Cesium.JulianDate.lessThanOrEquals(left, right)boolean

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

static Cesium.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
result JulianDate optional An existing instance to use for the result.
Returns:
The modified result parameter or a new instance if none was provided.

static Cesium.JulianDate.secondsDifference(left, right)number

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

static Cesium.JulianDate.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.
Name Type Description
julianDate JulianDate The date to be converted.
Returns:
A new instance representing the provided date.

static Cesium.JulianDate.toGregorianDate(julianDate, result)GregorianDate

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

static Cesium.JulianDate.toIso8601(julianDate, precision)string

Creates an ISO8601 representation of the provided date.
Name Type 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.
Returns:
The ISO8601 representation of the provided date.

static Cesium.JulianDate.totalDays(julianDate)number

Computes the total number of whole and fractional days represented by the provided instance.
Name Type Description
julianDate JulianDate The date.
Returns:
The Julian date as single floating point number.
Duplicates this instance.
Name Type Description
result JulianDate optional An existing instance to use for the result.
Returns:
The modified result parameter or a new instance if none was provided.

equals(right)boolean

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

equalsEpsilon(right, 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.
Name Type Default Description
right JulianDate optional The second instance.
epsilon number 0 optional The maximum number of seconds that should separate the two instances.
Returns:
true if the two dates are within epsilon seconds of each other; otherwise false.
Creates a string representing this date in ISO8601 format.
Returns:
A string representing this date in ISO8601 format.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.