java.text.DateFormat 日期格式化

一: java.text.DateFormat

<%@ page language="java"  contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ page import='java.util.Date'   %>
<%@ page import="java.text.DateFormat"  %>
<html lang="UTF-8">
<head>
<meta charset="UTF-80"/>
<title>Tody's date</title>
</head>
<body>
<%
    DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG);
  String s = dateFormat.format(new Date());
   out.println(s);
%>
</body>

</html>

 输出

二.java.util.Calendar类

Today is <%=java.util.Calendar.getInstance().getFirstDayOfWeek()%>

 

posted @ 2019-04-09 20:24  江期玉  阅读(1639)  评论(0编辑  收藏  举报