Fork me on GitHub
代码改变世界

js 返回时间 字符串

2012-11-05 12:05  freefei  阅读(261)  评论(0编辑  收藏  举报
返回 例如 2012103243 [php] function show(){ var date = new Date(); //日期对象 var now = ""; now = date.getFullYear()+""; //读英文就行了 now = now + (date.getMonth()+1)+"";//取月的时候取的是当前月-1如果想取当前月+1就可以了 now = now + date.getDate()+""; now = now + date.getHours()+""; now = now + date.getMinutes()+""; now = now + date.getSeconds()+""; //document.getElementById("nowDiv").innerHTML = now; //div的html是now这个字符串 //setTimeout("show()",1000); //设置过1000毫秒就是1秒,调用show方法 alert(now); } [/php]
@ https://github.com/ranmufei

守望者舆情监控

守望者舆情监控系统