This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

This API is available on Firefox OS for internal applications only.

The Time and Clock API is a simple way to change the system time.


The API is accessed through navigator.mozTime and returns a MozTimeManager object which exposes a single set() method.

The set() method is used to actually change the time of the system. It accepts a number or a Date object as parameter. If a number is provided, it represents the number of milliseconds since midnight UTC January 1, 1970.

Each time the time is changed, an event is fired. This event can be capture at the window object level by using the addEventListener method (using the moztimechange event name) or by attaching an event handler to the window.onmoztimechange property.

Note: If you want to change the timezone of your device, you have to use the Settings API.


function setTime(time) {

window.addEventListener('moztimechange', function () {
  console.log('Time has changed');

setTime(new Date());


Not part of any specification

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, teoli, kscarfone, Ephemera, justinpotts, Jeremie
 Last updated by: chrisdavidmills,