DateTime interface
A JavaScript object implementing the DateTime
interface represents a time period with an optional timezone. The end of the range does not need to be specified, in which case it is implicit from the start time and the precision.
DateTime
objects are used to specify dates and time values in a StoreObject
.
Construction
Use O.datetime()
.
Interface
function toString()
Returns a human-readable string representation. For clarity, the format will depend on the precision and the values of the range.
function toHTML()
Returns a similar string to toString()
, but with the text elements surrounded by HTML markup for extra clarity when displayed in a web page.
property start
The start time of the range in the UTC timezone, as a JavaScript Date
object.
property end
The end time of the range in the UTC timezone, as a JavaScript Date
object.
There will always be an end date, but if a range end was not explicitly specified when the DateTime
object was created, it will be generated using the start
and precision
. Use the specifiedAsRange
property if you need to determine if it is an explicit range.
property specifiedAsRange
true
if the DateTime
object was specified explicitly as a range.
property precision
The precision of this DateTime
, as one of the DateTime precision constants.
property timezone
A String representing the timezone, for example, 'GMT'
or 'Europe/London'
. If no timezone is specified, this property will be null
.