Created
December 16, 2013 15:48
-
-
Save NKjoep/7989220 to your computer and use it in GitHub Desktop.
JSP date manipulation sample: increase time give a date sample...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ page contentType="text/plain; charset=UTF-8" pageEncoding="UTF-8"%> | |
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> | |
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | |
<%@ taglib prefix="s" uri="/struts-tags" %> | |
<%@ taglib prefix="wp" uri="/aps-core" %> | |
<%@ taglib prefix="wpsa" uri="/apsadmin-core" %> | |
<%@ taglib prefix="wpsf" uri="/apsadmin-form" %> | |
<c:set var="random"><%= java.lang.Math.round(java.lang.Math.random() * 6) %></c:set> | |
<c:set var="startDate" value="${param.lastStreamTimestamp}" /> | |
<fmt:parseDate value="${startDate}" pattern="yyyy-MM-dd HH:mm:ss SSSS" var="startDate" type="both" /> | |
<c:forEach begin="0" end="${random}" varStatus="s"> | |
<fmt:parseDate value="${param.lastStreamTimestamp}" pattern="yyyy-MM-dd HH:mm:ss SSSS" var="startDate" type="both" /> | |
<c:set var="currentDate" value="${startDate}" /> | |
<c:set var="currentDate_time"><jsp:getProperty name="currentDate" property="time" /></c:set> | |
currentDate unouched: <jsp:getProperty name="currentDate" property="time" /> | |
<c:set var="currentDate_time" value="${currentDate_time + ((1000 * 60 * 60 * 25) * (random+1-s.index))}" /> | |
<jsp:setProperty name="currentDate" property="time" value="${currentDate_time}" /> | |
currentDate added <jsp:getProperty name="currentDate" property="time" /> | |
currentDate date <fmt:formatDate value="${currentDate}" pattern="yyyy-MM-dd HH:mm:ss SSSS" /> | |
<c:remove var="currentDate" /> | |
-- | |
</c:forEach> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment