<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.util.*"%>
<HTML>
<BODY>
<P>现在的时间是:
<% Date date=new Date();%>
<BR>
<%=date.toString()%>
</BODY>
</HTML>
<%@ page import="java.util.*"%>
<HTML>
<BODY>
<P>现在的时间是:
<% Date date=new Date();%>
<BR>
<%=date.toString()%>
</BODY>
</HTML>
<%@ 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>
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.util.*"%>
<HTML>
<BODY>
<P>现在的时间是:
<% Date date=new Date();%>
<BR>
<%=date%>
</BODY>
</HTML>
改成 <%=date%>
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.
<%@ 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太老了 ??可是正常启动呀!!(狠郁闷呀 !)和服务器配置有关么?我是自学周围没什么人问的!!请大家一定要帮忙呀 !!谢谢了 !!
<%@ 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:看看tomcat的后台有没有异常抛出
<%@ 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>
改成
<%=new Date()%>
改成
<%=new Date()%>
要是想显示到页面上就要用<%=%>或者<%out.print()%>