var date = new Date(1230604230000);
alert(date.toLocaleString())
解决方案 »
- 禁止页面放大缩小
- firebug命令行如何使用?
- 如何让文本框不能输入负号
- document.body.scrollLeft+event.clientX-divid.style.pixelLeft;????/
- 请问: 点击IE工具栏的返回按钮,让上一页自动刷新,代码是怎样的?
- JS初學者,大家推薦下應該看寫什麽書?
- 请高手指教一个三级联动菜单的问题!!
- focus()的问题
- 有谁懂PHP的去这里http://www.csdn.net/expert/topic/667/667563.xml?temp=.3611109
- 怎样定义数组
- 请教:JS强制弹出新窗口代码
- css如何写能让Firefox浏览器中自动适应内容的高度?
var theDate = date.toLocaleString();
var date = new Date(1230604230000);
var theDate = date.toLocaleString();
alert(theDate); 2008年12月30日 10:30:30
var theDdate1 = theDate.replace(/年/,'-')
var theDdate2 = theDdate1 .replace(/月/,'-')
var theDdate3 = theDdate2 .replace(/日/,'')
alert(theDdate3 )//2008-12-30 10:30:30
</script>
//這是您要得最後結果吧
放入参数以后就会时间不准确,请问这是为什么?
http://www.officego.cn
<script>
var date = new Date(1230604230000);
var theDate = date.toLocaleString();
alert(theDate); 2008年12月30日 10:30:30
var theDdate1 = theDate.replace(/年/,'-')
var theDdate2 = theDdate1 .replace(/月/,'-')
var theDdate3 = theDdate2 .replace(/日/,'')
alert(theDdate3 )//2008-12-30 10:30:30
</script> 而DATE里面用到的是精确到毫秒,所以要乘以1000在转换,就OK了