jquery 获取当前时间加180天

  • Post author:
  • Post category:其他


<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<jsp:include page="/jsp/common/header.jsp"></jsp:include>
<script src="${ctx }/js/points_cpt/points_cpt.js"></script>
<table class="queryTable">
  <tr>
        <td class="queryTitle" width="80px">开始时间</td>
        <td class="queryContent"><input class="inputText easyui-datetimebox" type="text" id="bgAddTime"  value="${bgAddTime}"/></td>
        <td class="queryTitle" width="80px">结束时间</td>
        <td class="queryContent"><input class="inputText easyui-datetimebox" type="text" id="endAddTime" value="${endAddTime}" /></td>
    <td class="queryBtnTd"><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search"  onclick="doQuery()">&nbsp;&nbsp;</a></td>
  </tr>
</table> 

<table id="queryPointCptGrid"></table>

    @RequestMapping(value="/toPage")
    public String toPage(HttpServletRequest request){
        /**
         * 系统的当前时间
         *
         */
        SimpleDateFormat bgAddTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        request.setAttribute("bgAddTime", bgAddTime.format(new Date()));
        /**
         *设置默认结束时间(+180天)
         */
        SimpleDateFormat endAddTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DAY_OF_YEAR, 180);
        request.setAttribute("endAddTime", endAddTime.format(calendar.getTime()));
        return "/jsp/points_cpt/points_cpt.jsp";
    }

转载于:https://www.cnblogs.com/wangchuanfu/p/6385056.html