XTime

Since Virtual Ticket uses separate date and time types, it is recommended that you use the XTime object instead of the Date object when working with times.

Core object

Created by

new XTime()
new XTime( hr_num )
new XTime( hr_num, min_num )
new XTime( hr_num, min_num, sec_num )

Parameters

Parameter Description
hr_num, min_num, sec_num Integer values representing part of a time.

Description

If you supply no arguments, the constructor creates a XTime object for the current local time. If you supply some arguments but not others, the missing arguments are set to 0.

The XTime object provides uniform behavior across platforms.

Example

The following example returns the time elapsed between timeA and timeB in seconds.

Property Summary

Property Description
constructor Specifies the function that creates an object's prototype.
prototype Allows the addition of properties to a XTime object.

Method Summary

Method Description
addHours Add hours to the specified XTime object.
addMinutes Add minutes to the specified XTime object.
addSeconds Add seconds to the specified XTime object.
getHours Returns the hour in the specified time according to local time.
getMinutes Returns the minutes in the specified time according to local time.
getSeconds Returns the seconds in the specified time according to local time.
setHours Sets the hours for a specified time according to local time.
setMinutes Sets the minutes for a specified time according to local time.
setSeconds Sets the seconds for a specified time according to local time.
toSource Returns an object literal representing the specified XTime object; you can use this value to create a new object. Overrides the Object.toSource method.
toString Returns a string representing the specified XTime object. Overrides the Object.toString method.
valueOf Returns the primitive value of a XTime object. Overrides the Object.valueOf method.

In addition, this object inherits the Object.watch and Object.unwatch methods from Object.

See Also

XDate, ServerTime

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.