<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.util.*"%>
  <HTML>
  <BODY>
   <P>现在的时间是:
     <% Date date=new Date();%>
   <BR>
      <%=date.toString()%>
   </BODY>
   </HTML>

解决方案 »

  1.   

    <%@ page contentType="text/html;charset=GB2312"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.text.*"%>
      <HTML>
      <BODY>
       <P>现在的时间是:
         <% Date date=new Date();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String str = df.format(date);
         %>
       <BR>
          <%=str%>
       </BODY>
       </HTML>
      

  2.   

    <%@=date%>多了@
          
    <%@ page contentType="text/html;charset=GB2312"%>
    <%@ page import="java.util.*"%>
      <HTML>
      <BODY>
       <P>现在的时间是:
         <% Date date=new Date();%>
       <BR>
          <%=date%>
       </BODY>
       </HTML>
      

  3.   

    <%@=date%>
    改成  <%=date%>
      

  4.   

    同意,Data会自动调用toString()的!
      

  5.   

    你知道Date的toString转换出来的是什么样吗?Converts this Date object to a String of the form: 
     dow mon dd hh:mm:ss zzz yyyywhere:
    dow is the day of the week (Sun, Mon, Tue, Wed, Thu, Fri, Sat). 
    mon is the month (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). 
    dd is the day of the month (01 through 31), as two decimal digits. 
    hh is the hour of the day (00 through 23), as two decimal digits. 
    mm is the minute within the hour (00 through 59), as two decimal digits. 
    ss is the second within the minute (00 through 61, as two decimal digits. 
    zzz is the time zone (and may reflect daylight savings time). Standard time zone abbreviations include those recognized by the method parse. If time zone informationi is not available, then zzz is empty - that is, it consists of no characters at all. 
    yyyy is the year, as four decimal digits. 
      

  6.   

    请大家班一下忙分析一下!!有这么一个程序
    <%@ page contentType="text/html;charset=GB2312"%>
    <%@ page import="java.util.*"%>
      <HTML>
      <BODY>
       <P>现在的时间是:
         <% Date date=new Date();%>
       <BR>
          <%=date%>   * 对不起在这里多写了一个@  *
       </BODY>
       </HTML>
    我不知道为什么!!运行的时候在屏幕上只能显示出 ("现在的时间是:")这些,
    地下就什么都没有了!!不知道为什么??请各位大侠帮帮忙!!!
    "我的服务器是(tomcat3.2.3比较老 )  jdk1.3   系统是win2000server"
    会不会是tomcat太老了 ??可是正常启动呀!!(狠郁闷呀 !)和服务器配置有关么?我是自学周围没什么人问的!!请大家一定要帮忙呀 !!谢谢了 !!
      

  7.   

    <%@ page contentType="text/html;charset=GB2312"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.text.*"%>
      <HTML>
      <BODY>
       <P>现在的时间是:
         <% Date date=new Date();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String str = df.format(date);
         %>
       <BR>
          <%=str%>
       </BODY>
       </HTML>你怎么就是不听呢!
      

  8.   

    1:先查看源文件看看有没有date的值
    2:看看tomcat的后台有没有异常抛出
      

  9.   

    这个我在我这儿使过了,可以!!
    <%@ page import = "java.text.*, java.util.*"%>
    <html>
    <body>
    <%
    Date d = new Date();
    String today = DateFormat.getDateInstance().format(d);
    %>
    Today is:
    <em><%= today%></em>
    </body>
    <html>
      

  10.   

    <% Date date=new Date();%>
    改成
    <%=new Date()%>
      

  11.   

    <% Date date=new Date();%>
    改成
    <%=new Date()%>
      

  12.   

    <% Date date=new Date();%>只是定义了一个日期类型而已。
    要是想显示到页面上就要用<%=%>或者<%out.print()%>