jquery获取当前日期

  1. <!DOCTYPE html>  
  2. <html lang="zh-CN"> 
  3. <head> 
  4. <meta charset="utf-8"> 
  5. <title>网页标题-www.divcss5.com</title> 
  6. <meta name="keywords" content="关键字" /> 
  7. <meta name="description" content="此网页描述" /> 
  8. </head> 
  9. <body> 
  10. <div class="current-time"></div>
  11. </body> 
  12. <script>
  13. setInterval(function(){
  14. var now=new Date();
  15. var time=now.getFullYear()+"-"+((now.getMonth()+1)<10?"0":"")+(now.getMonth()+1)+"-"+(now.getDate()<10?"0":"")+now.getDate();
  16. $(".current-time").text(time);
  17. },1000)
  18. </script>
  19. </html> 

猜你喜欢

转载自blog.csdn.net/leng0920/article/details/79581868