我刚搞web开发,用到很多javascript.对它很不了解,有个问题麻烦大家给解决下,如何根据long型的数据得到相应的yyyy-mm-dd hh:mi:ss格式的日期串呢?谢谢大家
解决方案 »
- 大家帮我看看这个页面的submit按钮是怎么实现的
- 关于JavaScript的问题 急急急急急急急急急急急!
- javascript /^[0-9]*$/ 和 /[0-9]*/有什么区别?
- 删除head元素
- 感觉很麻烦,帮我解决一下好吗?
- 为什么弹出窗口设置了没有状态栏。。可还是出现了状态栏。。。。
- 请问?像这样的字符串怎样截取?(111212121, 213213211, 123213211, 846544, 564544)
- include()函数问题
- 如何让一个窗口获得焦点后,能够自动显示在最前面?
- 为什么提示“对象不支持此属性或用法”???
- JS文件无法引入
- location.href的写法!!!!
var thedate = new Date()
var a= thedate.toLoaleString()//输出日期和时间
var b= thedate.toLocaleDateString()//输出日期
var c= thedate.toLocaleTimeString()//输出时间
{
var inputStr = "";
var format = this.format;
if(informat!=null)format = informat;
var o = {
"M+" : this.getMonth()+1,
"d+" : this.getDate(),
"h+" : this.getHours(),
"H+" : this.getHours(),
"m+" : this.getMinutes(),
"s+" : this.getSeconds()
}
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
{
format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k]:("00"+ o[k]).substr((""+ o[k]).length));
}
return format;
}//这样使用
var thedate = new Date(long 型数值);
alert(thedate.Format("yyyy-MM-dd hh:mm:ss"));