Date.prototype.toGMTString()

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

O método toGMTString() converte a data para uma cadeia de caracteres (string), usando as convenções de Internet para o Horário de Greenwich (GMT). O formato exato do valor retornado por toGMTString() varia de acordo com plataforma e navegador, em geral ele deve representar uma string legível para um ser humano.

Nota: toGMTString() está depreciado e não deve ser mais usado. Ele se mantém implementado somente para retrocompatibilidade; por favor use toUTCString().

Sintaxe

dateObj.toGMTString()

Valor de retorno

Uma string representando a data seguindo a convenção de Internet para o Horário de Greenwich (GMT).

Exemplos

Simple example

Neste exemplo, o método toGMTString() converte a data para GMT (UTC) usando o deslocamento de fuso horário do sistema operacional e retorna uma string que é similar a seguinta forma. O formato exato depende da plataforma.

js
var today = new Date();
var str = today.toGMTString();  // depreciado! use toUTCString()

console.log(str);               // Mon, 18 Dec 1995 17:28:35 GMT

Especificações

{{Specifications}}

Compatibilidade com navegadores

{{Compat}}

Veja também