本文介绍了我如何从约会中获得一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我来自荷兰,我在学校。我有约会,但现在我要显示该日期的工作日。

I'm from The Netherlands and I'm in school. I have a date but now I want to show a weekday from that date.

<!DOCTYPE html>
<html>
<head>
    <script>
    function getWeekday(d) {
    alert (d);
    var date = new Date();
    var weekday = new Array(7);
    weekday[0] = "Zondag";
    weekday[1] = "Maandag";
    weekday[2] = "Dinsdag";
    weekday[3] = "Woensdag";
    weekday[4] = "Donderdag";
    weekday[5] = "Vrijdag";
    weekday[6] = "Zaterdag";
    }


    function d() {
    document.getElementById("Weekdag").innerHTML = getWeekday ("2050-01-01");
    }
</script>
</head>
<body>

<p>Laat een weekdag zien</p>

<button onclick="d()">Klik voor weekdag</button>

<p id="Weekdag"></p>

</body>
</html>


推荐答案

使用日期实例,请致电。星期日是 0 等等。

using your Date instance, call getDay(). Sunday is 0 and so on.

这篇关于我如何从约会中获得一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 21:13