DATE类的简单应用
类别: JSP教程
<%@ page contentType="text/html;charset=gb2312" import="java.util.*" %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="NetObjects ScriptBuilder 3.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<center><font color=blue size=10 face="隶书">
<%
Date today = new Date();
int hours = today.getHours();
int minute = today.getMinutes();
if(hours>=0 && hours<12){
out.println("早上好!");
}else{
out.println("下午好!");
}
String[] weekdays = {"日","一","二","三","四","五","六"};
out.println("n今天是" + (today.getYear()+1900) + "年" + (today.getMonth()+1) + "月" + (today.getDate()) + "日星期" + weekdays[today.getDay()]);
%>
</font></center>
</BODY>
</HTML>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="NetObjects ScriptBuilder 3.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<center><font color=blue size=10 face="隶书">
<%
Date today = new Date();
int hours = today.getHours();
int minute = today.getMinutes();
if(hours>=0 && hours<12){
out.println("早上好!");
}else{
out.println("下午好!");
}
String[] weekdays = {"日","一","二","三","四","五","六"};
out.println("n今天是" + (today.getYear()+1900) + "年" + (today.getMonth()+1) + "月" + (today.getDate()) + "日星期" + weekdays[today.getDay()]);
%>
</font></center>
</BODY>
</HTML>
- 上一篇: JAVAMAIL实现SMTP身份认证
- 下一篇: 用JSP实现的一个日历程序
-= 资 源 教 程 =-
文 章 搜 索