📄 datetime.jsp
字号:
<%@ taglib uri="/tags/web-date" prefix="date"%>
<%@ taglib uri="/tags/web-loushang" prefix="loushang"%>
<%@ taglib uri="/tags/web-i18n" prefix="web"%>
<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="org.loushang.web.taglib.util.skin.SkinUtils,java.util.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<web:js src="calendar.js"/>
<link rel="stylesheet" type="text/css" href="<%=SkinUtils.getCSS(request,"css-xp1.css")%>">
<%
Map map =new HashMap();
//取得当前日期
SimpleDateFormat format=
new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date=new Date();
String now=format.format(date);
map.put("time",now);
request.setAttribute("html.data",map);
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
</head>
<table width="100%">
<tr>
<td><label class="title">年月日 时间 组件</label></td>
<% String file=request.getServletPath().substring(1);
String app=request.getContextPath();
%>
<td><label class="title">url:<%=file%></label></td>
<td align="right" valign="bottom" nowrap> [<a href="<%=app%>/src.jsp?target=<%=file %>" target="source">源代码</a>] </td>
</tr>
</table>
<hr>
<body>
<tr>
<td width=40%><button name="test" onclick="test()" value="test">显示日期值</button>
</td>
</tr>
<form name=mainform method=post>
<div align="center">
<center>
<!--日期html开始-->
<date:date name="date" property="time" divname="dateDiv" hastime="true" hasecond="true" sourceFormat="yyyy/MM/dd HH:mm:ss" targetFormat="yyyyMMdd HH:mm:ss" showLength="19">
</date:date>
<!--日期html结束-->
</center>
</div>
</form>
</body>
</html>
<script language="javascript">
function test(){
alert(dateDiv.getDateValue());
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -