From d9e9adb5f80a819fe46349bcf6d1faec734b09cd Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:07:31 +0800 Subject: remove span tag in zh-CN --- .../javascript/reference/global_objects/date/getday/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html index 86badcff49..e9b18b852e 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getday/index.html @@ -26,10 +26,10 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDay

下面第二条语句,基于{{jsxref("Date")}}对象 Xmas95 的值,把 1 赋值给 weekday。也就是说1995年12月25日是星期一。

-
var Xmas95 = new Date("December 25, 1995 23:15:30");
-var weekday = Xmas95.getDay();
+
var Xmas95 = new Date("December 25, 1995 23:15:30");
+var weekday = Xmas95.getDay();
 
-console.log(weekday); // 1
+console.log(weekday); // 1

注意:如果需要,可以使用{{jsxref("DateTimeFormat", "Intl.DateTimeFormat")}}与一个额外的options 参数,从而返回这天的全称(如"Monday").使用此方法,结果会更加国际化:

@@ -51,7 +51,7 @@ console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95)); 注解 - {{SpecName('ESDraft', '#sec-date.prototype.getday', 'Date.prototype.getDay')}} + {{SpecName('ESDraft', '#sec-date.prototype.getday', 'Date.prototype.getDay')}}   {{Spec2('ESDraft')}}   -- cgit v1.2.3-54-g00ecf