上面写错了,是下面这段代码输出成Mon Mar 06 2006 02:15:13 GMT+0800 (China Standard Time)这样的了,上面的只是把2006输出成106了。下载的代码我用format(return WeekFirstDay);输出后变成了一串1141583564750这样的数字,不明白是什么意思。function showWeekFirstDay()
{
var Nowdate=new Date();
var WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000);
return WeekFirstDay;
}

解决方案 »

  1.   

    http://blog.csdn.net/meizz/archive/2005/06/28/405708.aspxDate.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)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;
    };
    alert(new Date().format("yyyy-MM-dd"));
      

  2.   

    getYear() 的时间起始点是1900年,你应该用 getFullYear() 解决千年问题
    1141583564750 这个数字是相对的一个时间起始点(1970.1.1)到现在为止的毫秒差
      

  3.   

    晕,还是不知道怎么把Sun Mar 12 18:51:24 UTC+0800 2006转换成yyyy-mm-dd hh:mm:ss这样的格式~~~~~~