<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>曲发年少</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<%@ include file="include/header.jsp"%>
<div id="main_box">
<div id="main">
<% out.println("hello world<br>曲发年少JSP战斗测试<br><br>");%>
<%
Calendar cal=Calendar.getInstance();
out.println(cal.get(Calendar.YEAR)+"year"+cal.get(Calendar.MONTH)+"month"+cal.get(Calendar.DATE)+"day");
%>
<br>Calendar 类输出的时间
<%
out.println(cal.get(Calendar.HOUR)+":"+cal.get(Calendar.MINUTE)+":"+cal.get(Calendar.SECOND));
%>
<br>Date 类输出的时间
<%
Date today = new Date();
int hours = today.getHours();
int minute = today.getMinutes();
int second = today.getSeconds();
out.println(hours+":"+minute+":"+second);
if(hours>12)
out.println("<br>下午好");
else
out.println("<br>上午好");
%>
</div>
</div>
<%@ include file="include/footer.jsp"%>
</div>
</body>
</html>
Jsp 时间问题
最新推荐文章于 2020-12-31 06:20:08 发布