表示天文儒略日期,即自 1 月 1 日 -4712 年(公元前 4713 年)中午以来的天数。为了提高精度,此类将日期的整数部分和日期的秒部分存储在单独的组件中。为了算术安全并表示闰秒,日期始终以国际原子时间标准存储 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
static Cesium.JulianDate.leapSeconds : Array.<LeapSecond>
获取或设置整个 Cesium 中使用的闰秒列表。 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
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
复制 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:
修改后的结果参数或新实例(如果未提供)。如果 julianDate 未定义,则返回未定义。 The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
比较两个实例。 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.
计算提供的实例早于 UTC 的秒数。 Computes the number of seconds the provided instance is ahead of UTC.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
julianDate |
JulianDate | 日期。 The date. |
返回: Returns:
提供的实例早于 UTC 的秒数 The number of seconds the provided instance is ahead of UTC
计算提供的实例之间的天数差异。 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.
比较两个实例并返回 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.
比较两个实例并返回 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 日期创建一个新实例。 Creates a new instance from a JavaScript Date.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
date |
Date | JavaScript 日期。 A JavaScript Date. |
result |
JulianDate | 可选 optional 用于结果的现有实例。 An existing instance to use for the result. |
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if none was provided.
抛出: Throws:
-
DeveloperError : 日期必须是有效的 JavaScript 日期。 : date must be a valid JavaScript Date.
static Cesium.JulianDate.fromGregorianDate(date, result) → JulianDate
从 GregorianDate 创建一个新实例。 Creates a new instance from a GregorianDate.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
date |
GregorianDate | 公历日期。 A GregorianDate. |
result |
JulianDate | 可选 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 GregorianDate.
static Cesium.JulianDate.fromIso8601(iso8601String, result) → JulianDate
从 a 创建一个新实例 Creates a new instance from a from an ISO 8601 日期。该方法优于 date. This method is superior to
Date.parse 因为它将处理 ISO 8601 规范定义的所有有效格式,包括闰秒和亚毫秒时间,这些格式被大多数 JavaScript 实现所丢弃。 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.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
iso8601String |
string | ISO 8601 日期。 An ISO 8601 date. |
result |
JulianDate | 可选 optional 用于结果的现有实例。 An existing instance to use for the result. |
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if none was provided.
抛出: Throws:
-
DeveloperError :ISO 8601 日期无效。 : Invalid ISO 8601 date.
比较提供的实例并返回 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.
比较提供的实例并返回 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.
比较提供的实例并返回 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.
比较提供的实例并返回 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.
计算提供的实例之间的秒数差异。 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.
从提供的实例创建 JavaScript 日期。由于 JavaScript 日期仅精确到最接近的毫秒并且不能表示闰秒,因此请考虑使用 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 相反。如果提供的 JulianDate 处于闰秒期间,则使用前一秒。 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
| 名称 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.
创建所提供日期的 ISO8601 表示形式。 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:
所提供日期的 ISO8601 表示形式。 The ISO8601 representation of the provided date.
计算所提供实例表示的整数天和小数天的总数。 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.
clone(result) → JulianDate
复制此实例。 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.
将此实例与提供的实例进行比较并返回 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.
将此实例与提供的实例进行比较并返回 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.
创建一个以 ISO8601 格式表示该日期的字符串。 Creates a string representing this date in ISO8601 format.
返回: Returns:
以 ISO8601 格式表示此日期的字符串。 A string representing this date in ISO8601 format.
