[JSP]獲取時間

<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*"%>
<html><head><title>ex5-5.jsp</title></head>
<body>
<h1>
<br>
<center>
<%
    Date Nowdate = new Date();
    String nowhour = String.valueOf(Nowdate.getHours());
    String nowmin = String.valueOf(Nowdate.getMinutes());
    String nowsec = String.valueOf(Nowdate.getSeconds());
    
%>
如今是北京時間:
<%out.print(nowhour);%><%out.print(nowmin);%><%out.print(nowsec);%></center></h1></body>
</html> 
    
相關文章
相關標籤/搜索