• jsp日期插件My97DatePicker的使用


    1、下载My97DatePicker组件包 

    解压后放在web项目与jsp文件并列位置,即WebContent下

    2、在页面中引入该组件js文件:

     <script type="text/javascript" src="My97DatePicker/WdatePicker.js" charset=utf-8>

    3、例子

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
     <script type="text/javascript" src="My97DatePicker/WdatePicker.js" charset=utf-8>
     
     </script>
     <script type="text/javascript">
     </script>
    </head>
    <body>
    <form action="" method="post">
    <span>起始时间:</span>
    <input id="startDate" name="startDate" class="Wdate" type="text" onfocus="WdatePicker()" />
    <span>结束时间:</span>
    <input id="endDate" name="endDate" class="Wdate" type="text" onfocus="WdatePicker()" />
    <input type="submit" value="确定" />
    </form>
    </body>
    </html>

    其他页面接受这个两个时间代码:

    String startDate=new String(request.getParameter("startDate").getBytes("ISO-8859-1"),"utf-8");
    String endDate=new String(request.getParameter("endDate").getBytes("ISO-8859-1"),"utf-8");

    数据库查询两个时间段之间的数据代码(时间字段为date)

     String sql="select * from 表名 where date between '"+startDate+"' and '"+endDate+"'";

    注意:如果出现中文乱码问题,修改My97DatePicker文件夹下的config.js文件,编码方式改为utf-8:

    charset:'UTF-8'

  • 相关阅读:
    python 元类
    python中__init__()、__new__()、__call__()、__del__()用法
    python内置数据结构方法的时间复杂度
    时间复杂度和空间复杂度
    数据结构及算法(1)
    sys模块python
    python中的文本操作
    python 中的os模块
    python 几种不同的格式化输出
    【js】null 和 undefined的区别?
  • 原文地址:https://www.cnblogs.com/zhouerba/p/7371637.html
Copyright © 2020-2023  润新知