日期:2014-05-16  浏览次数:20370 次

获取当天时间
string   sStartTime   =   "2007-06-01 ";   //Request.QueryString[ "sStartTime "];
string   sEndTime   =     "2007-06-01 "   ;   //Request.QueryString[ "sEndTime "];

现在代码是这样     只是获取2007-06-01   这一天来查询     如何获取当天   或者昨天来替代 "2007-06-01 "  
      谢谢

------解决方案--------------------
<script>
var today=new Date();//今天
//today.setTime(today.getTime()-24*60*60*1000);//昨天
var y=today.getFullYear()
var m=today.getMonth()+1;
var d=today.getDate();
var todayStr=y+(m> 9? "- ": "-0 ")+m+(d> 9? "- ": "-0 ")+d;
alert(todayStr);
</script>