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
.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
julianDayNumber |
number |
0.0
|
可选 The Julian Day Number representing the number of whole days. Fractional days will also be handled correctly. |
secondsOfDay |
number |
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 |
TimeStandard.UTC
|
可选 The time standard in which the first two parameters are defined. |
成员(属性)
static Cesium.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.
方法
static Cesium.JulianDate.addDays(julianDate, days, result) → JulianDate
Adds the provided number of days to the provided date instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date. |
days |
number | The number of days to add or subtract. |
result |
JulianDate | An existing instance to use for the result. |
返回值:
The modified result parameter.
static Cesium.JulianDate.addHours(julianDate, hours, result) → JulianDate
Adds the provided number of hours to the provided date instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date. |
hours |
number | The number of hours to add or subtract. |
result |
JulianDate | An existing instance to use for the result. |
返回值:
The modified result parameter.
static Cesium.JulianDate.addMinutes(julianDate, minutes, result) → JulianDate
Adds the provided number of minutes to the provided date instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date. |
minutes |
number | The number of minutes to add or subtract. |
result |
JulianDate | An existing instance to use for the result. |
返回值:
The modified result parameter.
static Cesium.JulianDate.addSeconds(julianDate, seconds, result) → JulianDate
Adds the provided number of seconds to the provided date instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date. |
seconds |
number | The number of seconds to add or subtract. |
result |
JulianDate | An existing instance to use for the result. |
返回值:
The modified result parameter.
static Cesium.JulianDate.clone(julianDate, result) → JulianDate
Duplicates a JulianDate instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date to duplicate. |
result |
JulianDate | 可选 An existing instance to use for the result. |
返回值:
The modified result parameter or a new instance if none was provided. Returns undefined if julianDate is undefined.
Compares two instances.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | The first instance. |
right |
JulianDate | The second instance. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date. |
返回值:
The number of seconds the provided instance is ahead of UTC
Computes the difference in days between the provided instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | The first instance. |
right |
JulianDate | The second instance. |
返回值:
The difference, in days, when subtracting
right
from left
.
Compares two instances and returns
true
if they are equal, false
otherwise.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | 可选 The first instance. |
right |
JulianDate | 可选 The second instance. |
返回值:
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
.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
left |
JulianDate | 可选 The first instance. | |
right |
JulianDate | 可选 The second instance. | |
epsilon |
number |
0
|
可选 The maximum number of seconds that should separate the two instances. |
返回值:
true
if the two dates are within epsilon
seconds of each other; otherwise false
.
static Cesium.JulianDate.fromDate(date, result) → JulianDate
Creates a new instance from a JavaScript Date.
参数名称 | 类型 | 描述信息 |
---|---|---|
date |
Date | A JavaScript Date. |
result |
JulianDate | 可选 An existing instance to use for the result. |
返回值:
The modified result parameter or a new instance if none was provided.
Throws:
-
DeveloperError : date must be a valid JavaScript Date.
static Cesium.JulianDate.fromGregorianDate(date, result) → JulianDate
Creates a new instance from a GregorianDate.
参数名称 | 类型 | 描述信息 |
---|---|---|
date |
GregorianDate | A GregorianDate. |
result |
JulianDate | 可选 An existing instance to use for the result. |
返回值:
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
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
iso8601String |
string | An ISO 8601 date. |
result |
JulianDate | 可选 An existing instance to use for the result. |
返回值:
The modified result parameter or a new instance if none was provided.
Throws:
-
DeveloperError : Invalid ISO 8601 date.
Compares the provided instances and returns
true
if left
is later than right
, false
otherwise.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | The first instance. |
right |
JulianDate | The second instance. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | The first instance. |
right |
JulianDate | The second instance. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | The first instance. |
right |
JulianDate | The second instance. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | The first instance. |
right |
JulianDate | The second instance. |
返回值:
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());
.
参数名称 | 类型 | 描述信息 |
---|---|---|
result |
JulianDate | 可选 An existing instance to use for the result. |
返回值:
The modified result parameter or a new instance if none was provided.
Computes the difference in seconds between the provided instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
left |
JulianDate | The first instance. |
right |
JulianDate | The second instance. |
返回值:
The difference, in seconds, when subtracting
right
from left
.
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date to be converted. |
返回值:
A new instance representing the provided date.
static Cesium.JulianDate.toGregorianDate(julianDate, result) → GregorianDate
Creates a
GregorianDate
from the provided instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date to be converted. |
result |
GregorianDate | 可选 An existing instance to use for the result. |
返回值:
The modified result parameter or a new instance if none was provided.
Creates an ISO8601 representation of the provided date.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date to be converted. |
precision |
number | 可选 The number of fractional digits used to represent the seconds component. By default, the most precise representation is used. |
返回值:
The ISO8601 representation of the provided date.
Computes the total number of whole and fractional days represented by the provided instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
julianDate |
JulianDate | The date. |
返回值:
The Julian date as single floating point number.
clone(result) → JulianDate
Duplicates this instance.
参数名称 | 类型 | 描述信息 |
---|---|---|
result |
JulianDate | 可选 An existing instance to use for the result. |
返回值:
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.
参数名称 | 类型 | 描述信息 |
---|---|---|
right |
JulianDate | 可选 The second instance. |
返回值:
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
.
参数名称 | 类型 | 默认值 | 描述信息 |
---|---|---|---|
right |
JulianDate | 可选 The second instance. | |
epsilon |
number |
0
|
可选 The maximum number of seconds that should separate the two instances. |
返回值:
true
if the two dates are within epsilon
seconds of each other; otherwise false
.
Creates a string representing this date in ISO8601 format.
返回值:
A string representing this date in ISO8601 format.