要想在JSP页面中获得当前时间并显示出来,首先得导入相关的Java包,然后创建Date对象。

<%@page import="java.text.SimpleDateFormat,java.util.Date"%>
<%
String thisYear=new SimpleDateFormat("yyyy").format(new Date());
%>

在html中显示则使用

<%=thisYear%>

在html页面中获得当前时间

<span>Copyright @' + new Date().getFullYear() +'  Briefing.com, Inc. All rights reserved.</span>

 

相关文章:

  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-04-19
  • 2021-11-25
相关资源
相似解决方案