---
sourceDocument: Référence API Brésil
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/api-reference

 Release :

    - brazil

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence API Brésil

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Chronomètre (Next Experience) : client

# Chronomètre (Next Experience) : client {#ariaid-title1}

Rversion finale: Brazil  
Mis à jour 10 sept. 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute de lecture  
L'API StopWatch fournit des méthodes pour mesurer les durées dans le Cadre de travail de l'interface utilisateur Next Experience.
{#StopWatchAPINX__table_lgv_pzl_rfc__entry__3}

| Nom | Type | Description |
|-|-|-|
| démarré | [Objet date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | Date et heure de début du chronomètre. Cette valeur est définie lors de l'appel du constructeur [StopWatch(Object started)](https://servicenow-prod.fluidtopics.net/BkkizakRs1uArA3afBE4TQ#StopWatchNX-StopWatch "Constructeur pour initialiser un nouveau chronomètre.") ou de la méthode [restart().](https://servicenow-prod.fluidtopics.net/BkkizakRs1uArA3afBE4TQ#StopWatchNX-restart "Réinitialise l’heure de début du chronomètre à la date et à l’heure actuelles.") |
[Tableau 1. Propriétés]

{#StopWatchAPINX__table_lgv_pzl_rfc}

## Chronomètre(Next Experience) : Chronomètre(objet démarré) {#ariaid-title2}

Constructeur pour initialiser un nouveau chronomètre.
{#StopWatchNX-StopWatch__table_lgv_pzl_rfc__entry__3}

| Nom | Type | Description |
|-|-|-|
| démarré | [Objet date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | Facultatif. Date et heure à utiliser comme heure de début du chronomètre. Par défaut : date et heure actuelles. |
[Tableau 2. Paramètres]

{#StopWatchNX-StopWatch__table_lgv_pzl_rfc}  
Cet exemple initialise un nouveau chronomètre à partir de la date et de l'heure actuelles.

    var timer = new nowapi.StopWatch();

## Chronomètre(Next Experience) : getTime() {#ariaid-title3}

Renvoie le temps écoulé, en millisecondes, depuis le démarrage du chronomètre .
{#StopWatchNX-getTime__table_axh_pxl_rfc__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 3. Paramètres]

{#StopWatchNX-getTime__table_axh_pxl_rfc} {#StopWatchNX-getTime__table_bxh_pxl_rfc__entry__2}

| Type | Description |
|-|-|
| Numéro | Temps écoulé depuis le démarrage du chronomètre . Unité : millisecondes |
[Tableau 4. Renvoie]

{#StopWatchNX-getTime__table_bxh_pxl_rfc}  
Cet exemple renvoie le temps de chronomètre écoulé en millisecondes.

    var timer = new nowapi.StopWatch();
    console.log(timer.started);  //logs the StopWatch start date and time to the console
    var millis = timer.getTime();

## Chronomètre(Next Experience) - restart() {#ariaid-title4}

Réinitialise l'heure de début du chronomètre à la date et à l'heure actuelles.
{#StopWatchNX-restart__table_wb5_lcm_rfc__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 5. Paramètres]

{#StopWatchNX-restart__table_wb5_lcm_rfc} {#StopWatchNX-restart__table_xb5_lcm_rfc__entry__2}

| Type | Description |
|-|-|
| Aucun |   |
[Tableau 6. Renvoie]

{#StopWatchNX-restart__table_xb5_lcm_rfc}  
Cet exemple renvoie les millisecondes écoulées depuis le démarrage et le redémarrage du minuteur.

    var timer = new nowapi.StopWatch();
    console.log(timer.started);  //logs the StopWatch start date and time to the console
    timer.getTime();  //milliseconds since the timer started
    timer.restart();
    console.log(timer.started);  //logs the new StopWatch start date and time to the console
    timer.getTime();  //milliseconds since the timer restarted

## Chronomètre(Next Experience) : toString() {#ariaid-title5}

Renvoie le temps écoulé au format ISO 8601 (HH :mm :ss.sss) depuis le démarrage du chronomètre .
{#StopWatchNX-toString__table_mbh_rcm_rfc__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucune |   |   |
[Tableau 7. Paramètres]

{#StopWatchNX-toString__table_mbh_rcm_rfc} {#StopWatchNX-toString__table_nbh_rcm_rfc__entry__2}

| Type | Description |
|-|-|
| Chaîne | Durée au format ISO 8601 contenant les heures, minutes, secondes et millisecondes (HH :mm :ss.sss). |
[Tableau 8. Renvoie]

{#StopWatchNX-toString__table_nbh_rcm_rfc}  
Cet exemple renvoie le temps de chronomètre écoulé au format HH :mm :ss.sss.

    var timer = new nowapi.StopWatch();
    var duration = timer.toString();


