課程
/前端開發
/JavaScript
/JavaScript進階篇
如何設置2017年10月1號應該用setTime( )怎么寫
2017-07-31
源自:JavaScript進階篇 7-3
正在回答
設置具體的一天:
var?time=new?Date("2017/9/13,12:19:33");
更正:
<html>
<body>
<script type="text/javascript">
var mydate = new Date();
mydate.setTime(mydate.getTime()+61*24*60*60*1000);
document.write(mydate);
</script>
</body>
</html>
date.setTime(mydate.getTime()+61*24*60*60*1000);
這個是用setFullYear()方法設置時間
var d = new Date()
d.setFullYear(2017,10,1);
document.write(d)
這個是用setTime()方法設置時間
var d = new Date();
document.write(d+"<br/>");
d.setTime(d.getTime()+61*24*60*60*1000);
丶Felix
香寶的夫差 提問者 回復 丶Felix
舉報
本課程從如何插入JS代碼開始,帶您進入網頁動態交互世界
2 回答nodeType的值是如何確定的???
2 回答如何恢復設置?
1 回答如何設置時間顯示
4 回答多個邏輯操作符的優先級如何確定?
2 回答如何自由設置日期輸出的格式?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-08-02
設置具體的一天:
2017-07-31
更正:
<html>
<body>
<script type="text/javascript">
var mydate = new Date();
mydate.setTime(mydate.getTime()+61*24*60*60*1000);
document.write(mydate);
</script>
</body>
</html>
2017-07-31
<html>
<body>
<script type="text/javascript">
var mydate = new Date();
date.setTime(mydate.getTime()+61*24*60*60*1000);
document.write(mydate);
</script>
</body>
</html>
2017-07-31
這個是用setFullYear()方法設置時間
<html>
<body>
<script type="text/javascript">
var d = new Date()
d.setFullYear(2017,10,1);
document.write(d)
</script>
</body>
</html>
這個是用setTime()方法設置時間
<html>
<body>
<script type="text/javascript">
var d = new Date();
document.write(d+"<br/>");
d.setTime(d.getTime()+61*24*60*60*1000);
document.write(d)
</script>
</body>
</html>