From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../global_objects/date/todatestring/index.html | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 files/pt-br/web/javascript/reference/global_objects/date/todatestring/index.html (limited to 'files/pt-br/web/javascript/reference/global_objects/date/todatestring') diff --git a/files/pt-br/web/javascript/reference/global_objects/date/todatestring/index.html b/files/pt-br/web/javascript/reference/global_objects/date/todatestring/index.html new file mode 100644 index 0000000000..ac4e3cbc11 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/date/todatestring/index.html @@ -0,0 +1,127 @@ +--- +title: Date.prototype.toDateString() +slug: Web/JavaScript/Reference/Global_Objects/Date/toDateString +tags: + - Date + - JavaScript + - Prototipo + - Prototype + - Referencia + - metodo +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toDateString +--- +
{{JSRef}}
+ +

O método toDateString() retorna a porção da data de um objeto {{jsxref("Date")}} em um formato legível para humanos em inglês dos Estados Unidos.

+ +

Sintaxe

+ +
objetoDate.toDateString()
+ +

Descrição

+ +

Exemplares de {{jsxref("Date")}} referem-se a um ponto específico no tempo. Chamar {{jsxref("Date.prototype.toString()", "toString()")}} retorna a data num formato legível para humanos em inglês dos Estados Unidos. No SpiderMonkey, isso consiste na porção da data (dia, mês e ano) seguida pela porção da hora (horas, minutos, segundos e fuso horário). Ás vezes, deseja-se obter uma string apenas da porção da data; Isso pode ser conseguido com o método toDateString().

+ +

O método toDateString() é especialmente útil porque motores que implementam o padrão ECMA-262 podem divergir na string retornada pelo {{jsxref("Date.prototype.toString()", "toString()")}} de objetos {{jsxref("Date")}} , pois o formato é dependente da implentação e abordagens simples que repartem a string podem não produzir resultados consistentes nos vários motores.

+ +

Exemplos

+ +

Um uso básico de toDateString()

+ +
var d = new Date(1993, 6, 28, 14, 39, 7);
+
+console.log(d.toString());     // exibe Wed Jul 28 1993 14:39:07 GMT-0600 (PDT) no log
+console.log(d.toDateString()); // exibe Wed Jul 28 1993 no log
+
+ +

Especificações

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificaçãoSituaçãoComentário
{{SpecName('ES3')}}{{Spec2('ES3')}}Definição inicial.
{{SpecName('ES5.1', '#sec-15.9.5.3', 'Date.prototype.toDateString')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-date.prototype.todatestring', 'Date.prototype.toDateString')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-date.prototype.todatestring', 'Date.prototype.toDateString')}}{{Spec2('ESDraft')}} 
+ +

Compatibilidade entre navegadores

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FuncionalidadeChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suporte básico{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FuncionalidadeAndroidChrome para AndroidFirefox Móvel (Gecko)IE MóvelOpera MóvelSafari Móvel
Suporte básico{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

Ver também

+ + -- cgit v1.2.3-54-g00ecf