Built-In Namespace Date
Field Attributes | Field Name and Description |
---|---|
<static> |
Date.CultureInfo
|
Method Attributes | Method Name and Description |
---|---|
Adjust a localized date of the current Date object to a newly-specified timezone.
|
|
toJava()
Converts a JavaScript Date object into a Java Date object
|
|
toJSON(key)
|
Field Detail
<static>
Date.CultureInfo
Defined in: date.js.
Method Detail
{Boolean}
adjustTimezone()
Adjust a localized date of the current Date object to a newly-specified timezone.
By default, dates created in Javascript are created in the local
timezone, e.g. if I say "create a Date object at time 3PM", what I will
get is a Date that is set to 3PM for the local timezone that this
machine is running in. If our event source sends us the timezone, or
if it is set on the Event Source ESM object, then we want to adjust for
the specified timezone.
This routine uses the Java TimeZone object, so any TZ specifiers supported by that
method will be supported by this routine.
This method uses the timezone specified in the rec.s_TimeZone variable. This variable
is set by current Connectors if configured.
If the variable is not set, this code assumes that the TZ of the source device is local time,
and does not change the timezone of this Date object. If your device reports readable times in UTC, you
should set the instance.CONFIG.params.reportsUTC variable to 'true' - this will have the effect
of converting the local JS time to UTC, since that's the effective timezone of the event source (setting the
rec.s_TimeZone variable to 'UTC' would have the same effect here, but would break the use of ObserverTZ fields).
There is also a special case where the event source reports in UTC, but not as a normal datetime string - it reports
"seconds since the epoch". In this special case the JS Date constructor will recognize that the source is in UTC,
and do the proper conversion for you - you should set the instance.CONFIG.params.alreadyUTC parameter to true
so that no adjustment is made.
Defined in: utils.js.
Defined in: utils.js.
- Returns:
- {Boolean} Specifies whether a timezone adjustment was made.
{Java Date}
toJava()
Converts a JavaScript Date object into a Java Date object
Defined in: utils.js.
Defined in: utils.js.
- Returns:
- {Java Date} Java Date object
toJSON(key)
Defined in: json2.js.
- Parameters:
- key