The JavaScript Date object does not have full timezone support. Date objects allow only simple representations to denote a particular location's offset from Universal Coordinated Time (UTC). This is typically provided as a +/- offset from UTC-0 (also known as Greenwich Mean Time, or GMT) for example, +05:30 denotes that a location is 5 hours and 30 minutes ahead of UTC +00:00. The issue with this method is not getting the correct local time for a given date. The existing methods are sufficient for this purpose. The issue is correctly converting to and from local time and UTC for all points in time - in any of the past, present, and future - based on an initial time provided. This is important for defining relative dates, where a time in a given location may observe different UTC offsets, according to any Daylight Savings Rules (DST) in effect or any other changes that may occur to a location's time zone over time. Without the communication of the explicit time zone rules governing a given date and time, the ability to effectively calculate the offset of the local time to UTC or to any other time zone at any point in the past or future is lost.
This API can be used to get TZDate objects with full time zone support, convert them between timezones, retrieve available timezones.
For more information on the Time features, see Time Guide.
Since: 1.0
enum TimeDurationUnit { "MSECS", "SECS", "MINS", "HOURS", "DAYS" };
Since: 1.0
At least the following values must be supported:
[NoInterfaceObject] interface TimeManagerObject { readonly attribute TimeUtil time; };
Tizen implements TimeManagerObject;
Since: 1.0
There will be a tizen.time object that allows accessing the functionality of the Time API.
[NoInterfaceObject] interface TimeUtil { TZDate getCurrentDateTime() raises(WebAPIException); DOMString getLocalTimezone() raises(WebAPIException); DOMString[] getAvailableTimezones() raises(WebAPIException); DOMString getDateFormat(optional boolean? shortformat) raises(WebAPIException); DOMString getTimeFormat() raises(WebAPIException); boolean isLeapYear(long year) raises(WebAPIException); void setDateTimeChangeListener(SuccessCallback changeCallback) raises(WebAPIException); void unsetDateTimeChangeListener() raises(WebAPIException); void setTimezoneChangeListener(SuccessCallback changeCallback) raises(WebAPIException); void unsetTimezoneChangeListener() raises(WebAPIException); };
Since: 1.0
This interface offers methods to manage date/time as well as timezones such as:
getCurrentDateTime
TZDate getCurrentDateTime();
Since: 1.0
Return value:
TZDate The current TZDate objectExceptions:
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var current_dt = tizen.time.getCurrentDateTime(); console.log("current date/time is " + current_dt.toLocaleString());
getLocalTimezone
DOMString getLocalTimezone();
Since: 1.0
Return value:
Timezone The local timezoneExceptions:
with error type UnknownError, if the call failed due to an unknown error.
Code example:
console.log("The local time zone is " + tizen.time.getLocalTimezone());
getAvailableTimezones
DOMString[] getAvailableTimezones();
Since: 1.0
Zero or more slashes separate different components of a timezone identifier, with the most general descriptor first and the most specific one last. For example, 'Europe/Berlin', 'America/Argentina/Buenos_Aires'.
Return value:
The array of time zone identifiersExceptions:
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var tzids = tizen.time.getAvailableTimezones(); console.log("The device supports " + tzids.length + " time zones.");
getDateFormat
DOMString getDateFormat(optional boolean? shortformat);
Since: 1.0
Gets the date format according to the system's locale settings.
These expressions may be used in the returned string:
Examples of string formats include: "d/m/y", "y-d-m", "D, M d y".
Parameters:
Return value:
DOMString The date format according to the system's locale settingsExceptions:
with error type UnknownError, if the call failed due to an unknown error.
getTimeFormat
DOMString getTimeFormat();
Since: 1.0
Gets the time format according to the system's locale settings.
These expressions may be used in the returned string:
Examples of string formats include: "h:m:s ap", "h:m:s".
Return value:
DOMString The time format according to the system's locale settingsExceptions:
with error type UnknownError, if the call failed due to an unknown error.
isLeapYear
boolean isLeapYear(long year);
Since: 1.0
Parameters:
Return value:
boolean true, if the year is a leap yearExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var current_dt = tizen.time.getCurrentDateTime(); var is_leap = tizen.time.isLeapYear(current_dt.getFullYear()); if (is_leap) { console.log("This year is a leap year."); }
setDateTimeChangeListener
void setDateTimeChangeListener(SuccessCallback changeCallback);
Since: 2.3
Listener set with setTimezoneChangeListener() method is called when device time was set by the user.
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var changedCallback = function() { try { var current_dt = tizen.time.getCurrentDateTime(); console.log("current date/time is " + current_dt.toLocaleString()); } catch (err) { console.log (err.name + ": " + err.message); } }; tizen.time.setDateTimeChangeListener(changedCallback);
unsetDateTimeChangeListener
void unsetDateTimeChangeListener();
Since: 2.3
Exceptions:
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var changedCallback = function() { try { var current_dt = tizen.time.getCurrentDateTime(); console.log("current date/time is " + current_dt.toLocaleString()); tizen.time.unsetDateTimeChangeListener(); } catch (err) { console.log (err.name + ": " + err.message); } }; tizen.time.setDateTimeChangeListener(changedCallback);
setTimezoneChangeListener
void setTimezoneChangeListener(SuccessCallback changeCallback);
Since: 2.3
Listener set with setTimezoneChangeListener() method is called when device time zone has changed.
Parameters:
Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var changedCallback = function() { try { // The new time zone can be retrieved through tizen.time.getLocalTimezone() var zone = tizen.time.getLocalTimezone(); console.log("current time zone is " + zone); } catch (err) { console.log (err.name + ": " + err.message); } }; tizen.time.setTimezoneChangeListener(changedCallback);
unsetTimezoneChangeListener
void unsetTimezoneChangeListener();
Since: 2.3
Exceptions:
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var changedCallback = function() { try { var zone = tizen.time.getLocalTimezone(); console.log("current time zone is " + zone); tizen.time.unsetTimezoneChangeListener(); } catch (err) { console.log (err.name + ": " + err.message); } }; tizen.time.setTimezoneChangeListener(changedCallback);
[Constructor(optional Date? datetime, optional DOMString? timezone), Constructor(long year, long month, long day, optional long? hours, optional long? minutes, optional long? seconds, optional long? milliseconds, optional DOMString? timezone)] interface TZDate { long getDate(); void setDate(long date); long getDay(); long getFullYear(); void setFullYear(long year); long getHours(); void setHours(long hours); long getMilliseconds(); void setMilliseconds(long ms); long getMinutes(); void setMinutes(long minutes); long getMonth(); void setMonth(long month); long getSeconds(); void setSeconds(long seconds); long getUTCDate(); void setUTCDate(long date); long getUTCDay(); long getUTCFullYear(); void setUTCFullYear(long year); long getUTCHours(); void setUTCHours(long hours); long getUTCMilliseconds(); void setUTCMilliseconds(long ms); long getUTCMinutes(); void setUTCMinutes(long minutes); long getUTCMonth(); void setUTCMonth(long month); long getUTCSeconds(); void setUTCSeconds(long seconds); DOMString getTimezone(); TZDate toTimezone(DOMString tzid) raises(WebAPIException); TZDate toLocalTimezone() raises(WebAPIException); TZDate toUTC() raises(WebAPIException); TimeDuration difference(TZDate other) raises(WebAPIException); boolean equalsTo(TZDate other) raises(WebAPIException); boolean earlierThan(TZDate other) raises(WebAPIException); boolean laterThan(TZDate other) raises(WebAPIException); TZDate addDuration(TimeDuration duration) raises(WebAPIException); DOMString toLocaleDateString(); DOMString toLocaleTimeString(); DOMString toLocaleString(); DOMString toDateString(); DOMString toTimeString(); DOMString toString(); DOMString getTimezoneAbbreviation() raises(WebAPIException); long secondsFromUTC() raises(WebAPIException); boolean isDST() raises(WebAPIException); TZDate? getPreviousDSTTransition() raises(WebAPIException); TZDate? getNextDSTTransition() raises(WebAPIException); };
Since: 1.0
TZDate(optional Date? datetime, optional DOMString? timezone);
TZDate(long year, long month, long day, optional long? hours, optional long? minutes, optional long? seconds, optional long? milliseconds, optional DOMString? timezone);
getDate
long getDate();
Since: 1.0
Return value:
long The day of the month.setDate
void setDate(long date);
Since: 1.0
If it tries to set the day bigger than the last day of the month or smaller than 1, it will be calculated automatically. For example, if TZDate's month is May and parameter is 32, it will be June 1.
Parameters:
getDay
long getDay();
Since: 1.0
Return value:
long The day of the weekgetFullYear
long getFullYear();
Since: 1.0
Positive values indicate AD(Anno Domini) years. 0 and negative values indicate BC(Before Christ) years. For example, 1 = AD 1, 0 = BC 1, -1 = BC 2.
Return value:
long The yearsetFullYear
void setFullYear(long year);
Since: 1.0
Parameters:
getHours
long getHours();
Since: 1.0
Return value:
long The hoursetHours
void setHours(long hours);
Since: 1.0
If it tries to set the hour bigger than 23 or smaller than 0, it will be calculated automatically. For example, if hours is 24, it will set 0 and add to a date.
Parameters:
getMilliseconds
long getMilliseconds();
Since: 1.0
Return value:
long The millisecondssetMilliseconds
void setMilliseconds(long ms);
Since: 1.0
If it tries to set the millisecond bigger than 999 or smaller than 0, it will be calculated automatically. For example, if ms is 1000, it will set 0 and add to a second.
Parameters:
getMinutes
long getMinutes();
Since: 1.0
Return value:
long The minutessetMinutes
void setMinutes(long minutes);
Since: 1.0
If it tries to set the minute bigger than 59 or smaller than 0, it will be calculated automatically. For example, if minutes is 60, it will set 0 and add to an hour.
Parameters:
getMonth
long getMonth();
Since: 1.0
Return value:
long The monthsetMonth
void setMonth(long month);
Since: 1.0
If it tries to set the month bigger than 11 or smaller than 0, it will be calculated automatically. For example, if month is 12, it will set 0 and add to a year.
Parameters:
getSeconds
long getSeconds();
Since: 1.0
Return value:
long The secondssetSeconds
void setSeconds(long seconds);
Since: 1.0
If it tries to set the second bigger than 59 or smaller than 0, it will be calculated automatically. For example, if seconds is 60, it will set 0 and add to a minute.
Parameters:
getUTCDate
long getUTCDate();
Since: 1.0
Return value:
long The day of the month, according to universal timesetUTCDate
void setUTCDate(long date);
Since: 1.0
If it tries to set the day bigger than the last day of the month or smaller than 1, it will be calculated automatically. For example, if TZDate's month is May and date is 32, it will be June 1.
Parameters:
getUTCDay
long getUTCDay();
Since: 1.0
Return value:
long The day of the week, according to universal timegetUTCFullYear
long getUTCFullYear();
Since: 1.0
Positive values indicate AD(Anno Domini) years. 0 and negative values indicate BC(Before Christ) years. For example, 1 = AD 1, 0 = BC 1, -1 = BC 2.
Return value:
long The year, according to universal timesetUTCFullYear
void setUTCFullYear(long year);
Since: 1.0
Parameters:
getUTCHours
long getUTCHours();
Since: 1.0
Return value:
long The hour, according to universal timesetUTCHours
void setUTCHours(long hours);
Since: 1.0
If it tries to set the hour bigger than 23 or smaller than 0, it will be calculated automatically. For example, if hours is 24, it will set 0 and add to a date.
Parameters:
getUTCMilliseconds
long getUTCMilliseconds();
Since: 1.0
Return value:
long The milliseconds, according to universal timesetUTCMilliseconds
void setUTCMilliseconds(long ms);
Since: 1.0
If it tries to set the millisecond bigger than 999 or smaller than 0, it will be calculated automatically. For example, if ms is 1000, it will set 0 and add to a second.
Parameters:
getUTCMinutes
long getUTCMinutes();
Since: 1.0
Return value:
long The minutes, according to universal timesetUTCMinutes
void setUTCMinutes(long minutes);
Since: 1.0
If it tries to set the minute bigger than 59 or smaller than 0, it will be calculated automatically. For example, if minutes is 60, it will set 0 and add to an hour.
Parameters:
getUTCMonth
long getUTCMonth();
Since: 1.0
Return value:
long The month, according to universal timesetUTCMonth
void setUTCMonth(long month);
Since: 1.0
If it tries to set the month bigger than 11 or smaller than 0, it will be calculated automatically. For example, if month is 12, it will set 0 and add to a year.
Parameters:
getUTCSeconds
long getUTCSeconds();
Since: 1.0
Return value:
long The seconds, according to universal timesetUTCSeconds
void setUTCSeconds(long seconds);
Since: 1.0
If it tries to set the second bigger than 59 or smaller than 0, it will be calculated automatically. For example, if seconds is 60, it will set 0 and add to a minute.
Parameters:
getTimezone
DOMString getTimezone();
Since: 1.0
Zero or more slashes separate different components, with the most general descriptor first and the most specific one last. For example, 'Europe/Berlin', 'America/Argentina/Buenos_Aires'.
This attribute uniquely identifies the timezone.
Return value:
DOMString The string timezone identifiertoTimezone
TZDate toTimezone(DOMString tzid);
Since: 1.0
Parameters:
Return value:
TZDate The new TZDate in given TimezoneExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the provided TZID is not recognized as a valid timezone identifier.
with error type UnknownError, if the call failed due to an unknown error.
toLocalTimezone
TZDate toLocalTimezone();
Since: 1.0
Return value:
TZDate The new TZDate in local TimezoneExceptions:
with error type UnknownError, if the call failed due to an unknown error.
toUTC
TZDate toUTC();
Since: 1.0
Return value:
TZDate The Date/Time in UTCExceptions:
with error type UnknownError, if the call failed due to an unknown error.
difference
TimeDuration difference(TZDate other);
Since: 1.0
Calculates the difference in time between this and the other object. This comparison method takes timezones into consideration for the comparison.
The TimeDuration that is returned is effectively this - other. The return value is a duration in milliseconds both TZDate objects have a time component, in days, otherwise. The result value will be:
Parameters:
Return value:
TimeDuration The duration in milliseconds between the two date/time objects (or in days for comparison between dates with no time component)Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
equalsTo
boolean equalsTo(TZDate other);
Since: 1.0
This method takes the timezones into consideration and will return trueif the two TZDate objects represent the same instant in different timezones.
Parameters:
Return value:
boolean true if the 2 date/times are the sameExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
earlierThan
boolean earlierThan(TZDate other);
Since: 1.0
This method takes the timezones into consideration.
Parameters:
Return value:
boolean true, if the Date/Time is earlier than the one passed in argumentExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
laterThan
boolean laterThan(TZDate other);
Since: 1.0
This method takes the timezones into consideration.
Parameters:
Return value:
boolean true, if the Date/Time is later than the one passed in argumentExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
addDuration
TZDate addDuration(TimeDuration duration);
Since: 1.0
If the length of duration is negative, the new date/time will be earlier than it used to.
Note that calling this method does not alter the current object.
Parameters:
Return value:
TZDate The new TZDate by adding a durationExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var now = tizen.time.getCurrentDateTime(); var in_one_week = now.addDuration(new tizen.TimeDuration(7, "DAYS"));
toLocaleDateString
DOMString toLocaleDateString();
Since: 1.0
Return value:
DOMString The date portion of the TZDate object as a string, using locale conventionstoLocaleTimeString
DOMString toLocaleTimeString();
Since: 1.0
Return value:
DOMString The time portion of the TZDate object as a string, using locale conventionstoLocaleString
DOMString toLocaleString();
Since: 1.0
Return value:
DOMString The string representation of the TZDate object, using locale conventionstoDateString
DOMString toDateString();
Since: 1.0
Return value:
DOMString The date portion of the TZDate object as a stringtoTimeString
DOMString toTimeString();
Since: 1.0
Return value:
DOMString The time portion of the TZDate object as a stringtoString
DOMString toString();
Since: 1.0
Return value:
DOMString The string representation of the TZDate objectgetTimezoneAbbreviation
Deprecated. Some timezones return "GMT[+-]hh:mm". It is inconsistent.
DOMString getTimezoneAbbreviation();
Since: 1.0
For example, in Toronto this is currently "EST" during the winter months and "EDT" during the summer months when daylight savings time is in effect.
Return value:
DOMString The abbreviation of the time zone (such as "EST")Exceptions:
with error type UnknownError, if the call failed due to an unknown error.
secondsFromUTC
long secondsFromUTC();
Since: 1.0
Returns the offset (in seconds) from UTC of the timezone, accounting for daylight savings if it is in the timezone. For example, if time zone is GMT+8, it will return -32,400.
Return value:
long The offset from UTC in secondsExceptions:
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var offset = tizen.time.getCurrentDateTime().secondsFromUTC(); var myDate = new Date(); var exp_offset = myDate.getTimezoneOffset()*60; //offset is equals to exp_offset.
isDST
boolean isDST();
Since: 1.0
Indicates if daylight savings are in effect for the time zone and instant identified by the TZDate object.
Return value:
boolean The flag indicating whether the daylight saving are in effectExceptions:
with error type UnknownError, if the call failed due to an unknown error.
getPreviousDSTTransition
TZDate? getPreviousDSTTransition();
Since: 1.0
Return value:
TZDate The date of the previous daylight saving transition (before the instant identified by the TZDate)Exceptions:
with error type UnknownError, if the call failed due to an unknown error.
getNextDSTTransition
TZDate? getNextDSTTransition();
Since: 1.0
Return value:
TZDate The date of the next daylight saving transition (after the instant identified by the TZDate)Exceptions:
with error type UnknownError, if the call failed due to an unknown error.
[Constructor(long long length, optional TimeDurationUnit? unit)] interface TimeDuration { attribute long long length; attribute TimeDurationUnit unit; TimeDuration difference(TimeDuration other) raises(WebAPIException); boolean equalsTo(TimeDuration other) raises(WebAPIException); boolean lessThan(TimeDuration other) raises(WebAPIException); boolean greaterThan(TimeDuration other) raises(WebAPIException); };
Since: 1.0
Code example:
var now = tizen.time.getCurrentDateTime(); var tomorrow = now.addDuration(new tizen.TimeDuration(1, "DAYS")); // Becomes tomorrow, same time.
TimeDuration(long long length, optional TimeDurationUnit? unit);
The unit of the duration length (milliseconds, seconds, minutes, hours, or days) is determined by the duration unit attribute.
Since: 1.0
The default value is "MSECS" (milliseconds unit).
Since: 1.0
difference
TimeDuration difference(TimeDuration other);
Since: 1.0
Calculates the difference in time between this and other. The TimeDuration that is returned is effectively first - other (that is: positive if the first parameter is larger).
The returned TimeDuration is the biggest possible unit without losing the precision.
Parameters:
Return value:
The new TimeDuration object corresponding to the result of this - other.Exceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
// Assume that event1 and event2 are tizen.CalendarEvent objects. // Computes event1.duration - event2.duration var diff = event1.duration.difference(event2.duration); if (diff.length > 0) console.log("The event1 is longer than event2."); else if (diff.length == 0) console.log("The duration of two events is same."); else console.log("The event1 is shorter than the event2.");
equalsTo
boolean equalsTo(TimeDuration other);
Since: 1.0
This method takes the units into consideration and will return true if the two TimeDuration objects represent the same duration in different units.
Parameters:
Return value:
boolean true if the two TimeDuration object represent the same durationExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var d1 = new tizen.TimeDuration(60, "MINS"); // 60 minutes var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour var ret = d1.equalsTo(d2); // Returns true
lessThan
boolean lessThan(TimeDuration other);
Since: 1.0
This method takes the units into consideration when doing the comparison.
Parameters:
Return value:
boolean true if the TimeDuration is less than otherExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var d1 = new tizen.TimeDuration(1, "HOURS"); // 1 hour var d2 = new tizen.TimeDuration(120, "MINS"); // 120 minutes var ret = d1.lessThan(d2); // Returns true
greaterThan
boolean greaterThan(TimeDuration other);
Since: 1.0
This method takes the units into consideration when doing the comparison.
Parameters:
Return value:
boolean true if the TimeDuration is greater than otherExceptions:
with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if the call failed due to an unknown error.
Code example:
var d1 = new tizen.TimeDuration(120, "MINS"); // 120 minutes var d2 = new tizen.TimeDuration(1, "HOURS"); // 1 hour var ret = d1.greaterThan(d2); // Returns true
module Time { enum TimeDurationUnit { "MSECS", "SECS", "MINS", "HOURS", "DAYS" }; [NoInterfaceObject] interface TimeManagerObject { readonly attribute TimeUtil time; }; Tizen implements TimeManagerObject; [NoInterfaceObject] interface TimeUtil { TZDate getCurrentDateTime() raises(WebAPIException); DOMString getLocalTimezone() raises(WebAPIException); DOMString[] getAvailableTimezones() raises(WebAPIException); DOMString getDateFormat(optional boolean? shortformat) raises(WebAPIException); DOMString getTimeFormat() raises(WebAPIException); boolean isLeapYear(long year) raises(WebAPIException); void setDateTimeChangeListener(SuccessCallback changeCallback) raises(WebAPIException); void unsetDateTimeChangeListener() raises(WebAPIException); void setTimezoneChangeListener(SuccessCallback changeCallback) raises(WebAPIException); void unsetTimezoneChangeListener() raises(WebAPIException); }; [Constructor(optional Date? datetime, optional DOMString? timezone), Constructor(long year, long month, long day, optional long? hours, optional long? minutes, optional long? seconds, optional long? milliseconds, optional DOMString? timezone)] interface TZDate { long getDate(); void setDate(long date); long getDay(); long getFullYear(); void setFullYear(long year); long getHours(); void setHours(long hours); long getMilliseconds(); void setMilliseconds(long ms); long getMinutes(); void setMinutes(long minutes); long getMonth(); void setMonth(long month); long getSeconds(); void setSeconds(long seconds); long getUTCDate(); void setUTCDate(long date); long getUTCDay(); long getUTCFullYear(); void setUTCFullYear(long year); long getUTCHours(); void setUTCHours(long hours); long getUTCMilliseconds(); void setUTCMilliseconds(long ms); long getUTCMinutes(); void setUTCMinutes(long minutes); long getUTCMonth(); void setUTCMonth(long month); long getUTCSeconds(); void setUTCSeconds(long seconds); DOMString getTimezone(); TZDate toTimezone(DOMString tzid) raises(WebAPIException); TZDate toLocalTimezone() raises(WebAPIException); TZDate toUTC() raises(WebAPIException); TimeDuration difference(TZDate other) raises(WebAPIException); boolean equalsTo(TZDate other) raises(WebAPIException); boolean earlierThan(TZDate other) raises(WebAPIException); boolean laterThan(TZDate other) raises(WebAPIException); TZDate addDuration(TimeDuration duration) raises(WebAPIException); DOMString toLocaleDateString(); DOMString toLocaleTimeString(); DOMString toLocaleString(); DOMString toDateString(); DOMString toTimeString(); DOMString toString(); DOMString getTimezoneAbbreviation() raises(WebAPIException); long secondsFromUTC() raises(WebAPIException); boolean isDST() raises(WebAPIException); TZDate? getPreviousDSTTransition() raises(WebAPIException); TZDate? getNextDSTTransition() raises(WebAPIException); }; [Constructor(long long length, optional TimeDurationUnit? unit)] interface TimeDuration { attribute long long length; attribute TimeDurationUnit unit; TimeDuration difference(TimeDuration other) raises(WebAPIException); boolean equalsTo(TimeDuration other) raises(WebAPIException); boolean lessThan(TimeDuration other) raises(WebAPIException); boolean greaterThan(TimeDuration other) raises(WebAPIException); }; };