JavaScript Date.getHours()方法根据本地时间返回指定日期中的小时。getHours()返回的值是介于0和23之间的整数。
Date.getHours()
根据本地时间返回指定日期中的小时。
链接:https://www.learnfk.comhttps://www.learnfk.com/javascript/date-gethours.html
来源:LearnFk无涯教程网
<html> <head> <title>JavaScript getHours Method</title> </head> <body> <script type="text/javascript"> var dt=new Date("December 25, 1995 23:15:00"); document.write("getHours() : " + dt.getHours() ); </script> </body> </html>
运行上面代码输出
getHours() : 23
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)