function  showToDay(){
//封装日期
   var Nowdate=new Date();   
   var M=Number(Nowdate.getMonth())+1;
   return   Nowdate.getYear()+"-"+M+"-"+Nowdate.getDate()+"-"+Nowdate.getHours;     
}
这样写只有年月日,没有Hour;

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【wqfwuliao】截止到2008-06-26 14:21:14的历史汇总数据(不包括此帖):
    发帖数:1                  发帖分:1                  
    结贴数:1                  结贴分:1                  
    未结数:0                  未结分:0                  
    结贴率:100.00%            结分率:100.00%            
    敬礼!
      

  2.   

    http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html
    去这里看看,这个方法也被抛弃了
      

  3.   

    <%Date now = new Date();
    String y =""+now.getYear();
    String year = "20"+y.substring(1,3);
    int m = now.getMonth()+1;
    String month="";
    int d = now.getDate();
    String day = ""; 
    int w = now.getDay();
    String[] weekly = {"星期天","星期一","星期二","星期三","星期四","星期五","星期六"};
    if(m<10){
    month ="0"+m;
    }
    if(d<10){
    day = "0"+d;
    }else{
    day = ""+d;
    }
    String weekday = weekly[w];
    %>
    <%=year %>年<%=month %>月<%=day %>日  <%=weekday %>
      

  4.   


      <body>
        <%
         String pattern = "yyyy-MM-dd HH:mm:ss";
    Date date = new Date();
    date.setTime(System.currentTimeMillis());
    SimpleDateFormat format = new SimpleDateFormat(pattern);
    out.print(format.format(date));
         %>
      </body>
      

  5.   


    正解,如果还想要毫秒的话,就在ss后面再加上SSS,记得之间要空格
      

  6.   

    return  Nowdate.getYear()+"-"+M+"-"+Nowdate.getDate()+"-"+Nowdate.getHours;   
    =========================================
    return  Nowdate.getYear()+"-"+M+"-"+Nowdate.getDate()+"-"+Nowdate.getHours();   
      

  7.   

    在IE、firefox下执行LZ的JS都有提示啊,LZ没测过?
      

  8.   

    java.util.Date  newTimestamp= new Date(System.currentTimeMillis()); ---得到系统当前时间SimpleDateFormat TtiemFormat = new SimpleDateFormat("yyyy-MM-dd",Locale.ENGLISH); 
    --- 可以设置你所想要的格式
      

  9.   

    jsp页面里:
    <jsp:useBean id="now" class="java.util.Date"></jsp:useBean>
    <fmt:formatDate value="${now}" pattern="yyyy年M月dd日"/>
    在类里,f= new SimpleDateFormat(="yyyy年M月dd日") ;f.format(new Date()) ;
      

  10.   

    可以考虑用Clendar类,计算日期非常方便,具体自己研究下。
      

  11.   

    可以从数据库中取
    mysql:current_time
    sqlserver:getdate()