微信小程序getday方法_日期getDay()方法和JavaScript中的示例
·
微信小程序getday方法
JavaScript Date getDay()方法 (JavaScript Date getDay() method)
getDay() method is a Date's class method and it is used to get the current day of the week.
getDay()方法是Date的类方法,用于获取星期几。
It accepts nothing as the parameter and returns a value between 0 to 6 (based on the day of the week).
它不接受任何内容作为参数,并返回0到6之间的值(基于星期几)。
Note: The values 0 to 6 based on the weekdays, 0 for Sunday, 1 for Monday, ..., 6 for Saturday
注意:值0到6基于工作日,0代表星期日,1代表星期一,...,6代表星期六
Syntax:
句法:
var dt = new Date();
dt.getDay();
Examples:
例子:
Input:
var dt = new Date();
dt.getDay();
Output:
1 // if day of Monday
JavaScript code to get the current day of the week using getDay() method
JavaScript代码使用getDay()方法获取星期几
<html>
<head><title>JavaScipt Example</title></head>
<body>
<script>
var dt = new Date(); //Date constructor
var wday = dt.getDay(); //getting day of the week
//printing day
document.write("Today's weekday is: " + wday);
</script>
</body>
</html>
Output
输出量
Today's weekday is: 1
翻译自: https://www.includehelp.com/code-snippets/date-getDay-method-with-example-in-javascript.aspx
微信小程序getday方法
更多推荐


所有评论(0)