<html>
<head>
<head>
<body>
<script language="javascript">
//Date对象
// 从字符串中分析出时间
// var dateVal = Date.parse("November 1, 1997 10:15 AM");
// var current_time = new Date(dateVal);
// 获取系统时间的各个部分
var current_time = new Date();
var strDate = current_time.getYear() + "年" ;
strDate += (current_time.getMonth() + 1) + "月" ;
strDate += current_time.getDate() + "日" ;
strDate += current_time.getHours() + ":" ;
strDate += current_time.getMinutes() + ":" ;
strDate += current_time.getSeconds() ;
alert(strDate) ;
</script>
</body>
</html>
JavaScript - Date对象使用
最新推荐文章于 2022-01-30 09:34:44 发布