时间(遍历)

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<ul class="time">
 <!--秒杀开始时间戳--><li></li>
 <!--秒杀开始时间戳--><li></li>
 <!--秒杀开始时间戳--><li></li>
</ul>

<script src="js/jquery.1.11.js"></script>
<script>
$(document).ready(function(e) {
 var dat= new Date, year=dat.getFullYear(),month=dat.getMonth(),date=dat.getDate(),
 h=dat.getHours(),m=dat.getMinutes(),s=dat.getSeconds(),day=dat.getDate();
 //timestamp=Date.parse(date).toString().substr(0,10);//后台配合的时间戳
 $('.time li').each(function(index, element) {
  $(this).html(year+'年'+month+'月'+date+'日'+' '+h+'时'+m+'分'+s+'秒');
    });
});
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/xiaoleidiv/p/3711424.html