JavaScript 日期转化
怎么将这种类型
Mon Sep 15 00:00:00 CEST 2008
的日期转化为
2008-10-15
没人会吗?
JScript code:
function formatDate(D)
{//调整时间显示格式2007-01-01 12:00:00
return D.getFullYear() + "-" + (D.getMonth() + 1) + "-" + D.getDate() + " " + D.getHours() + ":" + D.getMinutes() + ":" + D.getSeconds();
}
alert("转化前:" + new Date());
alert("转化后:" + formatDate(new Date()));
JScript code:
if(!Date.prototype.format){//日期格式化
Date.prototype.format = function(format)
{
var o =
{
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}
if(/(y+)/.test(format))
format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)
相关问答:
var english = {"A","B","C","D","E","F","G","H","I","J","K","L","M",&qu ......
<a href="deleteIn.do?iid= <%=inForm.getInId()%>" >删除 </a>
点击删除后要提示是否删除
怎么搞啊
function onclick(){
if(confirm("是否要删除& ......
javascript如何获取所有input中的Radio类型的控件?
var input=document.getElementsByTagName("input");
for (var i = 0; i < input.length; i++) {
&nbs ......
<script language="javascript">
function printdate(){
var now=new Date();
var year=now.getYear();
var month=now.getMonth();
&n ......
C#写JAVASCRIPT 数组
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
& ......