编写一个显示当前时间的jsp页面

 

编写一个显示当前时间的jsp页面

代码:

复制代码
 1 <%@ page  language="java" contentType="text/html; charset=utf-8"
 2     pageEncoding="utf-8"%>
 3 <%@page import="java.util.Date" %>
 4 <%@page import="java.text.SimpleDateFormat" %>
 5 <!DOCTYPE html>
 6 <html>
 7 <head>
 8 <meta charset="utf-8">
 9 <title>显示系统时间</title>
10 </head>
11 <body>
12     <%
13     Date date=new Date();
14     SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
15     String today=df.format(date);
16     %>
17     当前时间:<%=today %>
18 </body>
19 </html>
复制代码

 

效果:

posted on 2023-03-24 22:01  杨申龙  阅读(20)  评论(0)    收藏  举报